-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins ver. 2.121.1
Blue Ocean 1.6.2
Git plugin 3.9.1
Considering the docs:
GIT_LOCAL_BRANCH - Name of the branch on Jenkins. When the "checkout to specific local branch" behavior is configured, the variable is published. If the behavior is configured as null or **, the property will contain the resulting local branch name sans the remote name.
I have set the checkout to specific local branch to ** using an SCM managed Jenkinsfile (not multibranch). In the Jenkinsfile I try to access the GIT_LOCAL_BRANCH variable but it is set to null. Same goes for the other env variables mentioned in the [docs|https://wiki.jenkins.io/display/JENKINS/Git+Plugin.]
On printing all the env variables using:
echo bat(script: 'env|sort', returnStdout: true)
none of the a fore mentioned env variable are available.
If I try to access the env variable in a normal job, it is set correctly.