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

jenkins.branch.Branch is not updated on child projects when corresponding jenkins.branch.BranchSource configuration is changed

XMLWordPrintable

      At https://github.com/jenkinsci/branch-api-plugin/blob/branch-api-1.6/src/main/java/jenkins/branch/MultiBranchProject.java#L308 you can see jenkins.branch.Branch#equals(Object) is used to determine whether the Branch needs saved on a project, however it only compares the sourceId and head. https://github.com/jenkinsci/branch-api-plugin/blob/branch-api-1.6/src/main/java/jenkins/branch/Branch.java#L167

      If an existing BranchSource is updated, neither of these fields change, therefore none of the existing child projects get updated.

      For example, if I change the URL of my Git repository and perform an indexing, the URL will not change on the children and they will continue to reference the previous URL.

      Another example, if I do not have the "Discard old builds" property set on the BranchSource, then add it later to keep only 5 builds and reindex, then existing children will continue to keep all builds even after a new build is triggered on that child.

      Only newly created children will receive the new BranchSource configuration.

            mjdetullio Matthew DeTullio
            mjdetullio Matthew DeTullio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: