I am using Branch Specifier option of Jenkins Git plugin (v2.0) to run build on specific branch, e.g. 1.4
.
${GIT_BRANCH}
in this case contains origin/1.4
value.
How can I receive a name of the local Git branch used for cloning (i.e. just 1.4
without origin/
prefix?
I've tried Check out to specific local branch
Additional Behaviour with branch name 1.4
, but nothing had changed.
I've seen related PR on GitHub, but it was declined (as it fixes only one case with just origin
remote).
git name-rev
give you what you want? – Magnus BäckGIT_*
environment variables for my builds. It turns out it's because I have Jenkins configured to watch more than one branch. There's a feature request to support this: issues.jenkins-ci.org/browse/JENKINS-7554 – markrian