[JENKINS-69942] build branch provided as parameter is not respected
In the job we are using parameter called BRANCH_NAME which is passed onto the plugin to clone and build the branch. Everything works fine, up to point that there is a build failure in any branch. After failure, the BRANCH_NAME requested to be build is ignored and the failed branch is always built.
How to reproduce the problem:
Create a simple job where you with parameter JOB_FAIL. Create a repository with few branches. Point the job to use the repository created. Build all the branches successfully. Once completed, build one branch with JOB_FAIL set true. After job failure, try building from a different branch and observe whether branch requested for the build is actually used.
In our tests, after failure, all other branches will use fail branch for the build rather than branch specified as parameter.
Potential work-around is to create a copy of the job and use it. Since copy doesn't have a build history, it uses branch requested through parameter.
Our job config.xml used for testing is attached.
Originally reported by
robson01, imported from: build branch provided as parameter is not respected
- status: Open
- priority: Major
- component(s): git-plugin
- resolution: Unresolved
- votes: 0
- watchers: 2
- imported: 2025-12-02
Raw content of original issue
In the job we are using parameter called BRANCH_NAME which is passed onto the plugin to clone and build the branch. Everything works fine, up to point that there is a build failure in any branch. After failure, the BRANCH_NAME requested to be build is ignored and the failed branch is always built.
How to reproduce the problem:
Create a simple job where you with parameter JOB_FAIL. Create a repository with few branches. Point the job to use the repository created. Build all the branches successfully. Once completed, build one branch with JOB_FAIL set true. After job failure, try building from a different branch and observe whether branch requested for the build is actually used.
In our tests, after failure, all other branches will use fail branch for the build rather than branch specified as parameter. Potential work-around is to create a copy of the job and use it. Since copy doesn't have a build history, it uses branch requested through parameter.
Our job config.xml used for testing is attached.
environment
JENKINS_VERSION 2.361.1<br/>
Git client plugin Version 3.12.1<br/>
Git Parameter Plug-In Version 0.9.18<br/>
Git plugin Version 4.12.1<br/>
Git server Version 1.10<br/>
GitHub Version 1.34.1<br/>
GitHub API Version 1.133<br/>
GitHub Branch Source Version 2.11.3