There have been a couple of requests for an environment variable that 
publishes the local branch name.  The current version of the Git Plugin has 
a new feature that targets Maven release builds, but can be leveraged by 
other builds.

The maven release plugin pushes a commit to git using the local branch name 
as:
git push origin local-branch:local-branch

The maven-release-plugin relies on the local branch name being the same as 
the remote branch name.  To facilitate this, the Git plugin version 2.4.4 
has a new feature.  You can configure the "checkout to specific local 
branch" behaviour as null (empty string) or ** (star star) to indicate that 
you want the code checked out to a local branch using the remote branch 
name.
origin/master checked out to local branch master
origin/my-new-feature checked out to local branch my-new-feature.

In addition, when the "checkout to specific local branch" behaviour is 
configured, a new environment variable GIT_LOCAL_BRANCH is published.  If 
the behaviour is configured as null or **, the property will contain the 
resulting local branch name sans the remote name.

This new functionality has not been described in the Git Plugin 
documentation yet, perhaps waiting for some positive feedback.  I'm using 
it quite successfully.

Michael


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/046e261b-f110-48bb-8af7-161e64c0bfa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to