jenkinsci / jenkinsci/git-plugin

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

Open
#3,251 2 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

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 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.

 

 

---
Originally reported by sahka, imported from: BuildData is not correct if same scm used but with different branches.


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • label(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 2025-12-02

Raw content of original issue

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.

 

 

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.