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

BuildData is not correct if same scm used but with different branches.

      I configured job with multiscm plugin and used same github project but with different branches.

      But branch for second project is not correctly identified because BuildData object is not correctly returned here:

      public @CheckForNull BuildData getBuildData(Run build) {
          BuildData buildData = null;
          while (build != null) {
              List<BuildData> buildDataList = build.getActions(BuildData.class);
              for (BuildData bd : buildDataList) {
                  if (bd != null && isRelevantBuildData(bd)) {
                      buildData = bd;
                      break;
                  }
              }
              if (buildData != null) {
                  break;
              }
              build = build.getPreviousBuild();
          }
      
          return buildData;
      }

      Guilty method is 

      isRelevantBuildData as under the hood it checks like this:

      return remoteUrls.contains(remoteUrl);
      

      and it doesn't honour branch name.

      So I think the proper fix is to add somehow branch name here.

       

       

          [JENKINS-48927] BuildData is not correct if same scm used but with different branches.

          Mark Waite added a comment -

          Is there a compelling reason why you're continuing to use the multi-scm plugin (with all of the challenges associated with that plugin) when the Pipeline plugins have much better support for operations with multiple repositories and multiple branches within a repository?

          In general, I am not investigating or fixing issues in the git plugin which are related to the multi-scm plugin.

          Mark Waite added a comment - Is there a compelling reason why you're continuing to use the multi-scm plugin (with all of the challenges associated with that plugin) when the Pipeline plugins have much better support for operations with multiple repositories and multiple branches within a repository? In general, I am not investigating or fixing issues in the git plugin which are related to the multi-scm plugin.

          markewaite yes, it could be reproduced using multi-scm plugin but I think the proper fix should be applied in git-plugin. And if pipeline uses the same logic then this issue will be also reproducible. Let me try in pipeline.

          alexander yushchenko added a comment - markewaite  yes, it could be reproduced using multi-scm plugin but I think the proper fix should be applied in git-plugin. And if pipeline uses the same logic then this issue will be also reproducible. Let me try in pipeline.

            Unassigned Unassigned
            sahka alexander yushchenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: