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

multiple jobDSL() pipeline steps destroys all but the last

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

      If you use the pipeline step jobDsl() twice or if you use the "Process job DSL" build step in the GUI only your last step works.

      This destroys anything in the earlier steps.

      Example. Given two jobDSL sections with the following jobDSL:

      folder('zz-folder1')
      job('zz-folder1/job-one')
      
      folder('zz-folder2')
      job('zz-folder2/job-two')
      

      You then get this as the output:

      Processing provided DSL script
      Added items:
          GeneratedJob{name='zz-folder1'}
          GeneratedJob{name='zz-folder1/job-one'}
      Unreferenced items:
          GeneratedJob{name='zz-tron'}
          GeneratedJob{name='zz-tron2'}
      
      Processing provided DSL script
      Added items:
          GeneratedJob{name='zz-folder2'}
          GeneratedJob{name='zz-folder2/job-two'}
      Unreferenced items:
          GeneratedJob{name='zz-folder1'}
          GeneratedJob{name='zz-folder1/job-one'}
      Removed items:
          GeneratedJob{name='zz-folder1'}
      
      Finished: SUCCESS
      

      If you want to set different actions (e.g. DELETE vs. DISABLE) or "ignore changes" then you're going to have a bad day as all but your last jobs get deleted.

          [JENKINS-50875] multiple jobDSL() pipeline steps destroys all but the last

          Christian Höltje created issue -
          Christian Höltje made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Christian Höltje made changes -
          Summary Original: multiple jobDSL() pipeline steps clobber each other. New: multiple jobDSL() pipeline steps destroys all but the last
          Daniel Spilker made changes -
          Link New: This issue duplicates JENKINS-41389 [ JENKINS-41389 ]
          Daniel Spilker made changes -
          Link New: This issue duplicates JENKINS-44142 [ JENKINS-44142 ]
          Daniel Spilker made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Daniel Spilker made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            daspilker Daniel Spilker
            docwhat Christian Höltje
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: