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

Job DSL rebuilds all jobs when a folder is created with views inside

XMLWordPrintable

      After branch-api version 2.5.5 was released, this change was introduced https://issues.jenkins-ci.org/browse/JENKINS-39682.

       

      Now every-time a XML for a job changes it triggers a re-build of the job. There are a few problems with this. First, I use Bitbucket cloud which has API limits and I have hundreds of jobs in Jenkins. If they all keep triggering scans it breaks everything as the API limits can't are exceeded.

       

      I have made it in a way that the job XMLs themselves very rarely change. They will only change once in a few months if we decide to add a new trait etc... So that part is ok. But, all those hundreds of jobs leave inside folders. 

       

      If the XML of folder change, all jobs inside will trigger scans as well. I don't see a reason for this. I believe it would be beneficial to try to avoid triggering re-scans for child items if the parent changes.

       

      My folders themselves don't rarely change as well. The problem is that we have views inside the folders, and those are making it trigger the child jobs on EVERY seed job run.

       

      Consider this code:

      folder("folderName") {
        views {
          listView("viewName") {
            jobs {
              names(["folderName/test1", "folderName/test2"].toArray(new String[0]))
            }
            recurse()
            columns {
              status()
              weather()
              name()
              lastSuccess()
              lastFailure()
              lastDuration()
              buildButton()
            }
          }
        }
      }
      

      This somehow makes it trigger on every run. The XML of the folder does not actually change, but it trigger scans on every child item anyway.

      Also, considering that a view CAN change often, triggering the child items for this is not a good idea.

      I was hoping this re-scanning could be avoided all together, but if has to stay, at least that folders could behave better and not trigger the child items.

            jamietanna Jamie Tanna
            michelzanini Michel Zanini
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: