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

Action for removed jobs is not updated and applied to previously removed jobs if it's changed

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • job-dsl-plugin
    • None
    • Jenkins 2.387.2
      JOB-DSL 1.83

      The Action for removed jobs is not updated to previously removed jobs if it's changed from one strategy to another

       

      Steps to reproduce:

      • Configure JOB DSL --> Action for removed jobs: Disable
      • Lets assume that the DSL script contains two Jobs named Test-1 and Test-2
        .
        .
        
        pipelineJob('F__Folder1/F__Folder2/Test-1') {
          description('Test-1 Job')
        }
        
        pipelineJob('F__Folder1/F__Folder2/Test-2') {
          description('Test-2 Job')
        }
        
        .
        .
      • Run the Seed Job the result will be two Jobs Test-1 and Test-2 are generated
      • Now remove Test-2 job from the DSL scripts
      .
      .
      
      pipelineJob('F__Folder1/F__Folder2/Test-1') {
        description('Test-1 Job')
      }
      
      .
      .
      

       

      • Run the Seed Job the result will be Job Test-2 will be disabled
      • Now change the JOB DSL configuration --> Action for removed jobs: Delete
      • Run the Seed Job the result will be the same for Job Test-2, which will be disabled and it will not be deleted
        • Which is unexpected behaviour as the Job Test-2 is still tracked by the Seed job. However the new config strategy which is 'Delete' is not applied to this previously removed Job Test-2 (which is already disabled as per the old strategy) before the strategy configuration change.
      • Now remove Test-1 Job from the DSL scripts
      • Run the Seed Job the result will be Job Test-1 will be deleted, However Job Test-2 will still exists and disabled.
      • Conclusion:
        • The Action for removed jobs strategy configuration is only applied for all the Jobs that are removed from the DSL scripts since the configuration strategy selection and in case the strategy configuration is changed, this new strategy does not apply for all the previously affected Jobs with the old strategy (while the old strategy remains in effect for these jobs).
      • Expected behaviour:
        • Action for removed jobs in case changed should be updated and applied for any previously tracked removed jobs that were affected by the old strategy. Not only to the newly removed jobs since the strategy change.

          [JENKINS-71099] Action for removed jobs is not updated and applied to previously removed jobs if it's changed

          I’m not sure the expected behavior should be what you’re proposing. 

          I can see both sides of the behavior having merit, but your side carries more risk of unintended consequences when you think at scale (100 jobs+)

           

          Ezequiel Santamaria added a comment - I’m not sure the expected behavior should be what you’re proposing.  I can see both sides of the behavior having merit, but your side carries more risk of unintended consequences when you think at scale (100 jobs+)  

          Harvy added a comment - - edited

          Hi Ezequiel ,

          Thank you for your kind feedback, Unfortunately there is no solid explanation on how the strategy change should behave, but this is what I expected since the old strategy disabled jobs were still tracked by the plugin, so i expected that after strategy change to deletion, these jobs would have been deleted, which was not the case.

           

          IMHO it really becomes an issue specially when the Jobs are (100 jobs+), I see no risk since this strategy change is usually done intentionally and the admin should know what he is doing specially if this is clearly stated, then It would make sense that the new strategy should be applied to all the tracked jobs, otherwise the manual deletion of (100+ jobs) becomes really a tedious task. Additionally since the plugin supports SCM, then restoration of these deleted jobs is an easier task in comparison to manual deletion of (100+ jobs).

           

          In case you still see a risk, perhaps a check box could be added to allow application of the new strategy to the previously affected jobs by the old strategy

          for instance in case strategy is changed from disable to delete, this deletion is applied to previously disabled jobs in case checked, otherwise they are not affected

          Harvy added a comment - - edited Hi Ezequiel , Thank you for your kind feedback, Unfortunately there is no solid explanation on how the strategy change should behave, but this is what I expected since the old strategy disabled jobs were still tracked by the plugin, so i expected that after strategy change to deletion, these jobs would have been deleted, which was not the case.   IMHO it really becomes an issue specially when the Jobs are (100 jobs+), I see no risk since this strategy change is usually done intentionally and the admin should know what he is doing specially if this is clearly stated, then It would make sense that the new strategy should be applied to all the tracked jobs, otherwise the manual deletion of (100+ jobs) becomes really a tedious task. Additionally since the plugin supports SCM, then restoration of these deleted jobs is an easier task in comparison to manual deletion of (100+ jobs).   In case you still see a risk, perhaps a check box could be added to allow application of the new strategy to the previously affected jobs by the old strategy for instance in case strategy is changed from disable to delete, this deletion is applied to previously disabled jobs in case checked, otherwise they are not affected

            jamietanna Jamie Tanna
            harvynbb Harvy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: