jenkinsci / jenkinsci/git-plugin

[JENKINS-69942] build branch provided as parameter is not respected

Open
#3,762 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

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

Git client plugin Version 3.12.1

Git Parameter Plug-In Version 0.9.18

Git plugin Version 4.12.1

Git server Version 1.10

GitHub Version 1.34.1

GitHub API Version 1.133

GitHub Branch Source Version 2.11.3
```

1 attachment

- [config.xml](https://issues.jenkins.io/secure/attachment/59358/config.xml)

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.