Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44142

Step jobDsl can be used at most once in pipeline with DELETE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • job-dsl-plugin
    • None

      The example for the jobDsl pipeline step shows usage that cannot actually be used:

      https://github.com/jenkinsci/job-dsl-plugin/wiki/User-Power-Moves#use-job-dsl-in-pipeline-scripts

      node {
          jobDsl scriptText: 'job("example-2")'
      
          jobDsl targets: ['jobs/projectA/*.groovy', 'jobs/common.groovy'].join('\n'),
                 removedJobAction: 'DELETE',
                 removedViewAction: 'DELETE',
                 lookupStrategy: 'SEED_JOB',
                 additionalClasspath: ['libA.jar', 'libB.jar'].join('\n')
      }
      

      This will always delete the job "example-2" because the second step DELETEs all unfreferenced items, unless of course one of the scripts also happens to create a job named "example-2".

       

      From my brief look at the source, I don't think this would be easy to implement. However, it would still be incredibly useful to be able to call jobDsl multiple times with different arguments.

       

            jamietanna Jamie Tanna
            vqrs Christian V
            Votes:
            6 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: