jenkinsci / jenkinsci/git-plugin

[JENKINS-33827] Git build chooser only obeys first child of the extensions section

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

Description

This issue was spun out of JENKINS-33695.

Consider the following snippet from a job config.xml:

"hudson.plugins.git.GitSCM" plugin="git@​2.4.4">

2


gitlab
[URL]
[CREDENTIAL]




**/master


**/bleeding


false
"list"/>


"hudson.plugins.git.util.AncestryBuildChooser">
14




"hudson.plugins.git.util.InverseBuildChooser"/>



According to this snippet, there should be two criteria for selecting a commit to build - it should both be less than 14 days old, and it should not be the master or bleeding branch (i.e. the chosen commit would be in the intersection of all BuildChooser selections).

Currently, this is not the case, and the plugin will select any commit less than 14 days old for building.

The breaking change seems to have been introduced in 2.4.1; 2.4.0 still produces the expected behavior.

---
Originally reported by zmeggyesi, imported from: Git build chooser only obeys first child of the extensions section


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

Raw content of original issue

This issue was spun out of JENKINS-33695.

Consider the following snippet from a job config.xml:



<scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.4">

<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name>gitlab</name>
<url>[URL]</url>
<credentialsId>[CREDENTIAL]</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>**/master</name>
</hudson.plugins.git.BranchSpec>
<hudson.plugins.git.BranchSpec>
<name>**/bleeding</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions>
<hudson.plugins.git.extensions.impl.BuildChooserSetting>
<buildChooser class="hudson.plugins.git.util.AncestryBuildChooser">
<maximumAgeInDays>14</maximumAgeInDays>
<ancestorCommitSha1/>
</buildChooser>
</hudson.plugins.git.extensions.impl.BuildChooserSetting>
<hudson.plugins.git.extensions.impl.BuildChooserSetting>
<buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
</hudson.plugins.git.extensions.impl.BuildChooserSetting>
</extensions>
</scm>

According to this snippet, there should be two criteria for selecting a commit to build - it should both be less than 14 days old, and it should not be the master or bleeding branch (i.e. the chosen commit would be in the intersection of all BuildChooser selections).

Currently, this is not the case, and the plugin will select any commit less than 14 days old for building.

The breaking change seems to have been introduced in 2.4.1; 2.4.0 still produces the expected behavior.

environment

```
git-plugin 2.4.4

Jenkins 1.653
```

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.