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

Workflow sidebar has duplicated Git Build Data links

      In a Workflow build, if you use certain resources in >1 node, you get duplication of the links in the left navigation pane when you look at the info page for a build that has already run. To reproduce, install the Workflow plugin, create a new Workflow job, and give it a configuration like:

      node {
        git branch: "master", credentialsId: '', url: 'git@mygitrepo/project.git'
      }
      node {
        git branch: "master", credentialsId: '', url: 'git@mygitrepo/project.git'
      }
      node {
        git branch: "master", credentialsId: '', url: 'git@mygitrepo/project.git'
      }
      

      Each time you use the git resource within a new node, it causes duplication of the nav items as shown in the attached screenshot. This issue is not confined to the workflow+git combination. I have also seen it with the 'Show Build Parameters' plugin, where there is duplication of the Parameters link in the nav pane, but I can't seem to reproduce that issue consistently. I suspect that other plugins which add something to the nav field on a per-job basis could have similar issues.

      I'm attaching a support bundle from my MacOS test Jenkins server, and also a build.xml that shows the issue.

        1. support.zip
          31 kB
        2. Screen Shot 2017-10-26 at 9.53.46 am.png
          Screen Shot 2017-10-26 at 9.53.46 am.png
          17 kB
        3. Screen Shot 2015-07-09 at 12.01.47 PM.png
          Screen Shot 2015-07-09 at 12.01.47 PM.png
          129 kB
        4. jenkins.log
          11 kB
        5. build.xml
          10 kB

          [JENKINS-29326] Workflow sidebar has duplicated Git Build Data links

          Jesse Glick added a comment -

          The multiple Git Build Data links is a known issue; possibly a bug in the Git plugin, needs to be investigated. In general if a plugin was expecting something it ran to only ever be called once per build, but from a workflow it is potentially called multiple times, then it needs to be modified to make sure it does not call Run.addAction multiple times on the same build with the same class of action unless this is really intentional (for example if each instance has a distinctive displayName).

          If you see duplicated sidebar links of another kind, better to file a separate issue, with steps to reproduce if possible.

          Jesse Glick added a comment - The multiple Git Build Data links is a known issue; possibly a bug in the Git plugin, needs to be investigated. In general if a plugin was expecting something it ran to only ever be called once per build, but from a workflow it is potentially called multiple times, then it needs to be modified to make sure it does not call Run.addAction multiple times on the same build with the same class of action unless this is really intentional (for example if each instance has a distinctive displayName ). If you see duplicated sidebar links of another kind, better to file a separate issue, with steps to reproduce if possible.

          Owen Mehegan added a comment -

          Tagging with git-plugin and optimistically assigning to Mark to take a look

          Owen Mehegan added a comment - Tagging with git-plugin and optimistically assigning to Mark to take a look

          Jesse Glick added a comment -

          Reverting, I had this where I wanted it.

          Jesse Glick added a comment - Reverting, I had this where I wanted it.

          Jesse Glick added a comment -

          Particularly ugly with multibranch projects, which always check out the same repository multiple times.

          Jesse Glick added a comment - Particularly ugly with multibranch projects, which always check out the same repository multiple times.

          Andrew Bayer added a comment -

          This turned out to be pretty simple - the git plugin blindly adds BuildData, GitTagAction and changelogs every time you call checkout, even if you've, for some reason, already checked out that particular repo/hash before. https://github.com/jenkinsci/git-plugin/pull/372 adds equals methods to BuildData and Build, and decides whether to actually call build.addAction for the BuildData and GitTagAction later in the checkout, by comparing to existing BuildData already on the build, if any - it also skips GitTagAction and changelogs if it's already processed this BuildData.

          Andrew Bayer added a comment - This turned out to be pretty simple - the git plugin blindly adds BuildData , GitTagAction and changelogs every time you call checkout , even if you've, for some reason, already checked out that particular repo/hash before. https://github.com/jenkinsci/git-plugin/pull/372 adds equals methods to BuildData and Build , and decides whether to actually call build.addAction for the BuildData and GitTagAction later in the checkout , by comparing to existing BuildData already on the build , if any - it also skips GitTagAction and changelogs if it's already processed this BuildData .

          What about the BuildData that comes when using "Workflow from SCM", can that be taken out? The only relevant build data and changes are those of the project itself, not those of the Workflow from SCM.

          Martin d'Anjou added a comment - What about the BuildData that comes when using "Workflow from SCM", can that be taken out? The only relevant build data and changes are those of the project itself, not those of the Workflow from SCM.

          Andrew Bayer added a comment -

          If the workflow from scm is coming from a different repo/hash than the rest of the project, it'll still show up, albeit only once. Any repo/hash combo that gets checked out will show up once and only once, no matter how many times it's checked out.

          Andrew Bayer added a comment - If the workflow from scm is coming from a different repo/hash than the rest of the project, it'll still show up, albeit only once. Any repo/hash combo that gets checked out will show up once and only once, no matter how many times it's checked out.

          Andrew Bayer added a comment -

          So there is another aspect to this - with my fix, you don't get duplicate BuildData added to the build, but if you have multiple repos checked out during the build, the "Git Build Data" links are all actually the same link, which makes sense. The build page shows the multiple BuildData actions, but .../(job)/(build number)/git is just the first one. I'm honestly not sure the right way to make those distinct, though - something involving getUrlName for sure.

          Andrew Bayer added a comment - So there is another aspect to this - with my fix, you don't get duplicate BuildData added to the build, but if you have multiple repos checked out during the build, the "Git Build Data" links are all actually the same link, which makes sense. The build page shows the multiple BuildData actions, but .../(job)/(build number)/git is just the first one. I'm honestly not sure the right way to make those distinct, though - something involving getUrlName for sure.

          I changed my mind a little bit. I think it is useful to see if the "Workflow from SCM" Git repo has changed, but for the users, they need to be able to tell which BuildData is which, and which change list is which. See the attachment for JENKINS-29840. I think showing the "human part" name of the repo URL is a step in the right direction.

          Martin d'Anjou added a comment - I changed my mind a little bit. I think it is useful to see if the "Workflow from SCM" Git repo has changed, but for the users, they need to be able to tell which BuildData is which, and which change list is which. See the attachment for JENKINS-29840 . I think showing the "human part" name of the repo URL is a step in the right direction.

          Andrew Bayer added a comment -

          Note, btw, that the de-duplication is only done in checkout - if you add a BuildData from somewhere else (i.e., like the ghprb plugin does), that'll get added regardless, though if you add it before checkout and it's a duplicate of the BuildData that gets generated there, the new one won't be added.

          Andrew Bayer added a comment - Note, btw, that the de-duplication is only done in checkout - if you add a BuildData from somewhere else (i.e., like the ghprb plugin does), that'll get added regardless, though if you add it before checkout and it's a duplicate of the BuildData that gets generated there, the new one won't be added.

          Andrew Bayer added a comment -

          deepchip - sounds like that merits a separate JIRA to improve the UI aspects of multiple BuildData on a single build. That'd involve my comment above in re: the links for legit multiple BuildData still being the same.

          Andrew Bayer added a comment - deepchip - sounds like that merits a separate JIRA to improve the UI aspects of multiple BuildData on a single build. That'd involve my comment above in re: the links for legit multiple BuildData still being the same.

          sounds like that merits a separate JIRA to improve the UI aspects of multiple BuildData on a single build

          That separate Jira, is it already JENKINS-29840?

          • This issue: deal with duplication
          • JENKINS-29840: identify the repos shown on the Build page (BuildData and SHA1 list in the centre of the page).

          But jglick closed it as a duplicate of this issue.

          Martin d'Anjou added a comment - sounds like that merits a separate JIRA to improve the UI aspects of multiple BuildData on a single build That separate Jira, is it already JENKINS-29840 ? This issue: deal with duplication JENKINS-29840 : identify the repos shown on the Build page ( BuildData and SHA1 list in the centre of the page). But jglick closed it as a duplicate of this issue.

          Andrew Bayer added a comment -

          Yup - reopened it.

          Andrew Bayer added a comment - Yup - reopened it.

          Jesse Glick added a comment -

          The strange fix of JENKINS-30985 could probably be reverted once WorkflowJob.getSCMs is fixed to remove duplicates.

          Jesse Glick added a comment - The strange fix of JENKINS-30985 could probably be reverted once WorkflowJob.getSCMs is fixed to remove duplicates.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          http://jenkins-ci.org/commit/workflow-plugin/2ff48824c9be593441339bda3d402136e2a73831
          Log:
          Test for JENKINS-29326.

          Marked as @Ignore until
          https://github.com/jenkinsci/git-plugin/pull/372 is merged and
          released, at which point we'll need to bump the git plugin version as well.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java http://jenkins-ci.org/commit/workflow-plugin/2ff48824c9be593441339bda3d402136e2a73831 Log: Test for JENKINS-29326 . Marked as @Ignore until https://github.com/jenkinsci/git-plugin/pull/372 is merged and released, at which point we'll need to bump the git plugin version as well.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java
          http://jenkins-ci.org/commit/workflow-plugin/3840d8ca847ed0ea8097c2f62e7b21504190afad
          Log:
          Merge pull request #271 from abayer/jenkins-29326

          JENKINS-29326 Don't add duplicate BuildData (downstream)

          Compare: https://github.com/jenkinsci/workflow-plugin/compare/ae6814b47c28...3840d8ca847e

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java http://jenkins-ci.org/commit/workflow-plugin/3840d8ca847ed0ea8097c2f62e7b21504190afad Log: Merge pull request #271 from abayer/jenkins-29326 JENKINS-29326 Don't add duplicate BuildData (downstream) Compare: https://github.com/jenkinsci/workflow-plugin/compare/ae6814b47c28...3840d8ca847e

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          src/main/java/hudson/plugins/git/util/Build.java
          src/main/java/hudson/plugins/git/util/BuildData.java
          http://jenkins-ci.org/commit/git-plugin/b4a4c7d63106ea1b7989d579f99e60ceef0271af
          Log:
          [FIXED JENKINS-29326] Don't add duplicate BuildData.

          Added equals methods to BuildData and Build, and check if we already
          have an equivalent BuildData on a build before we add it, the git tag
          action and changelog, so that we avoid duplicate records of all these things.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/util/Build.java src/main/java/hudson/plugins/git/util/BuildData.java http://jenkins-ci.org/commit/git-plugin/b4a4c7d63106ea1b7989d579f99e60ceef0271af Log: [FIXED JENKINS-29326] Don't add duplicate BuildData. Added equals methods to BuildData and Build, and check if we already have an equivalent BuildData on a build before we add it, the git tag action and changelog, so that we avoid duplicate records of all these things.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          src/main/java/hudson/plugins/git/util/Build.java
          src/main/java/hudson/plugins/git/util/BuildData.java
          http://jenkins-ci.org/commit/git-plugin/959bca0d9f92b31ed83c991bdbd6c24c2463daa3
          Log:
          Merge pull request #372 from abayer/jenkins-29326

          JENKINS-29326 Don't add duplicate BuildData

          Compare: https://github.com/jenkinsci/git-plugin/compare/056e522feed4...959bca0d9f92

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/util/Build.java src/main/java/hudson/plugins/git/util/BuildData.java http://jenkins-ci.org/commit/git-plugin/959bca0d9f92b31ed83c991bdbd6c24c2463daa3 Log: Merge pull request #372 from abayer/jenkins-29326 JENKINS-29326 Don't add duplicate BuildData Compare: https://github.com/jenkinsci/git-plugin/compare/056e522feed4...959bca0d9f92

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          pom.xml
          http://jenkins-ci.org/commit/workflow-plugin/1be577d5127648aadb39e74e65967d52e6b0b367
          Log:
          Moving to git plugin 2.4.1 and enabling test for JENKINS-29326

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java pom.xml http://jenkins-ci.org/commit/workflow-plugin/1be577d5127648aadb39e74e65967d52e6b0b367 Log: Moving to git plugin 2.4.1 and enabling test for JENKINS-29326

          Code changed in jenkins
          User: Jesse Glick
          Path:
          aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java
          pom.xml
          http://jenkins-ci.org/commit/workflow-plugin/e0e457dcacbf9e4e2a4e80c2aae6d765fbb92867
          Log:
          Merge pull request #288 from abayer/use-new-git-version

          Moving to git plugin 2.4.1 and enabling test for JENKINS-29326

          Compare: https://github.com/jenkinsci/workflow-plugin/compare/7b4e1f0fc91f...e0e457dcacbf

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/scm/GitStepTest.java pom.xml http://jenkins-ci.org/commit/workflow-plugin/e0e457dcacbf9e4e2a4e80c2aae6d765fbb92867 Log: Merge pull request #288 from abayer/use-new-git-version Moving to git plugin 2.4.1 and enabling test for JENKINS-29326 Compare: https://github.com/jenkinsci/workflow-plugin/compare/7b4e1f0fc91f...e0e457dcacbf

          Code changed in jenkins
          User: Jesse Glick
          Path:
          CHANGES.md
          http://jenkins-ci.org/commit/workflow-plugin/2f2efded09b9c81e3d04186dc5ac4cb8710b9290
          Log:
          JENKINS-29326 JENKINS-31153 Noting #271 and #296.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md http://jenkins-ci.org/commit/workflow-plugin/2f2efded09b9c81e3d04186dc5ac4cb8710b9290 Log: JENKINS-29326 JENKINS-31153 Noting #271 and #296.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          demo/plugins.txt
          http://jenkins-ci.org/commit/workflow-plugin/a93596909db6b3b6a9aa6c1c0b07ba012e2f3873
          Log:
          JENKINS-29326 Updated git plugin (and dependencies) to pick up fix.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: demo/plugins.txt http://jenkins-ci.org/commit/workflow-plugin/a93596909db6b3b6a9aa6c1c0b07ba012e2f3873 Log: JENKINS-29326 Updated git plugin (and dependencies) to pick up fix.

          Andrew Bayer added a comment -

          So, weirdly, I've now stumbled into a case where this still happens - git 2.4.1, pipeline 1.13, https://ci.jenkins-ci.org/job/tmp-jenkins-20-jenkinsfile/5/. There are only two BuildData entries in the build's build.xml, but four links are showing up on the sidebar. So...weird?

          Andrew Bayer added a comment - So, weirdly, I've now stumbled into a case where this still happens - git 2.4.1, pipeline 1.13, https://ci.jenkins-ci.org/job/tmp-jenkins-20-jenkinsfile/5/ . There are only two BuildData entries in the build's build.xml , but four links are showing up on the sidebar. So...weird?

          Andrew Bayer added a comment -

          And I should mention that it legitimately should have 2 BuildData, but no more than that.

          Andrew Bayer added a comment - And I should mention that it legitimately should have 2 BuildData , but no more than that.

          Andrew Bayer added a comment -

          Ah-ha! With the embeddable build status plugin, this duplicates, without, it doesn't. Seems to be JENKINS-28642 (in this case, but could be another plugin) causing it.transientActions in WorkflowRun/sidePanel.jelly to barf leading to duplicate actions being put in the sidebar. deepchip, I know you're seeing this still - do you see any stacktraces in jenkins.log when you load an offending build page? And jglick, any ideas for a workaround?

          Andrew Bayer added a comment - Ah-ha! With the embeddable build status plugin, this duplicates, without, it doesn't. Seems to be JENKINS-28642 (in this case, but could be another plugin) causing it.transientActions in WorkflowRun/sidePanel.jelly to barf leading to duplicate actions being put in the sidebar. deepchip , I know you're seeing this still - do you see any stacktraces in jenkins.log when you load an offending build page? And jglick , any ideas for a workaround?

          Andrew Bayer added a comment -

          Confirmed that with embeddable build status 1.9-SNAPSHOT (after the fix for JENKINS-28642 went in), I don't see duplicate actions any more.

          Andrew Bayer added a comment - Confirmed that with embeddable build status 1.9-SNAPSHOT (after the fix for JENKINS-28642 went in), I don't see duplicate actions any more.

          Martin d'Anjou added a comment - - edited

          Yes indeed I see a stacktrace when I visit a page with a duplicate build data in the left side menu, and it has it.transientActions in it. See the jenkins.log file attached. I am running Jenkins 1.625.2, Pipeline 1.13, Git Plugin 2.4.1, Embeddable build status 1.8.

          Martin d'Anjou added a comment - - edited Yes indeed I see a stacktrace when I visit a page with a duplicate build data in the left side menu, and it has it.transientActions in it. See the jenkins.log file attached. I am running Jenkins 1.625.2, Pipeline 1.13, Git Plugin 2.4.1, Embeddable build status 1.8.

          Jesse Glick added a comment -

          The fix got broken again in 2.4.2.

          Jesse Glick added a comment - The fix got broken again in 2.4.2.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/plugins/git/util/BuildData.java
          http://jenkins-ci.org/commit/git-plugin/7e501ab38c60ad203cd5f1cdce8a9683c4fb89d8
          Log:
          [FIXED JENKINS-29326] Restore lost BuildData.equals override.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/plugins/git/util/BuildData.java http://jenkins-ci.org/commit/git-plugin/7e501ab38c60ad203cd5f1cdce8a9683c4fb89d8 Log: [FIXED JENKINS-29326] Restore lost BuildData.equals override.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java
          http://jenkins-ci.org/commit/workflow-job-plugin/ec2575b1f03ea1bb4cce4d53c2b78aec626e5c28
          Log:
          Merge pull request #271 from abayer/jenkins-29326

          JENKINS-29326 Don't add duplicate BuildData (downstream)
          Originally-Committed-As: 3840d8ca847ed0ea8097c2f62e7b21504190afad

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java http://jenkins-ci.org/commit/workflow-job-plugin/ec2575b1f03ea1bb4cce4d53c2b78aec626e5c28 Log: Merge pull request #271 from abayer/jenkins-29326 JENKINS-29326 Don't add duplicate BuildData (downstream) Originally-Committed-As: 3840d8ca847ed0ea8097c2f62e7b21504190afad

          trejkaz added a comment -

          Did someone revert the fix? It's showing five for me.

          trejkaz added a comment - Did someone revert the fix? It's showing five for me.

          Nick Jones added a comment -

          This is happening to me today on Jenkins 2.89.2 LTS with Pipeline Job 2.16. I've got 3 "Git Build Data" links in the left-hand menu (URLs ending in "git", "git-2", and "git-3"), and moreover, the main panel lists three Git revision SHAs that aren't actually part of my repository. This is a Multibranch Pipeline job building a pull request using the default "Merging the pull request with the current target branch revision" behavior. It also shows two Changes sections in the main panel listing the same Git commit message twice, in case that's relevant or related.

          Nick Jones added a comment - This is happening to me today on Jenkins 2.89.2 LTS with Pipeline Job 2.16. I've got 3 "Git Build Data" links in the left-hand menu (URLs ending in "git", "git-2", and "git-3"), and moreover, the main panel lists three Git revision SHAs that aren't actually part of my repository. This is a Multibranch Pipeline job building a pull request using the default "Merging the pull request with the current target branch revision" behavior. It also shows two Changes sections in the main panel listing the same Git commit message twice, in case that's relevant or related.

          Max M added a comment - - edited

          May I ask why is this Priority: Minor?
          Can this be escalated?

          There are like dozens of duplicates of this issue (see e.g. JENKINS-38204 – the SVN lineage of dupes), and it looks like it's getting "fixed", then broken, then fixed again, then broken again... Is this an architectural problem in Jenkins?

          Can anybody fix this once-and-for-all?

          Max M added a comment - - edited May I ask why is this Priority: Minor ? Can this be escalated? There are like dozens of duplicates of this issue (see e.g. JENKINS-38204 – the SVN lineage of dupes), and it looks like it's getting "fixed", then broken, then fixed again, then broken again... Is this an architectural problem in Jenkins? Can anybody fix this once-and-for-all?

            Unassigned Unassigned
            owenmehegan Owen Mehegan
            Votes:
            28 Vote for this issue
            Watchers:
            37 Start watching this issue

              Created:
              Updated: