jenkinsci / jenkinsci/git-plugin
[JENKINS-12655] GIT_BRANCH is incorrect in build steps when branch choosing strategy is set to inverse (but it is correct in build name macro)
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
Context: I'm trying to create a parameterized job chain for our branches.
Version info:
Jenkins 1.450
Git 1.1.15
build-name-setter 1.3
parametrized trigger 2.12
1) Set the git branch to */master and in advanced, select branching strategy = inverse
2) Set the build name (using plugin) to #${BUILD_NUMBER}.${GIT_BRANCH}
3) In the build, use shell to execute: echo ${BUILD_BRANCH}
4) Push a change into a branch in git then manually start the build in Jenkins
Result:
The build string is set correctly to the branch used in step#4, but the echo in step #3 incorrectly says origin/master. Note, that the wrong GIT_BRANCH is also sent in my parameterized trigger.
The setting for GIT_BRANCH is correct at all times when Default choosing strategy is selected.
---
Originally reported by
rmorgenstein, imported from: GIT_BRANCH is incorrect in build steps when branch choosing strategy is set to inverse (but it is correct in build name macro)
Raw content of original issue
Context: I'm trying to create a parameterized job chain for our branches.
Version info:
Jenkins 1.450
Git 1.1.15
build-name-setter 1.3
parametrized trigger 2.121) Set the git branch to */master and in advanced, select branching strategy = inverse
2) Set the build name (using plugin) to #${BUILD_NUMBER}.${GIT_BRANCH}
3) In the build, use shell to execute: echo ${BUILD_BRANCH}
4) Push a change into a branch in git then manually start the build in JenkinsResult:
The build string is set correctly to the branch used in step#4, but the echo in step #3 incorrectly says origin/master. Note, that the wrong GIT_BRANCH is also sent in my parameterized trigger.The setting for GIT_BRANCH is correct at all times when Default choosing strategy is selected.
Contributor guide
Assessment
This issue has not been assessed yet.