|
I think the bug is fixed. I just ran a series of tests which confirmed that I can checkout to the branch
. It expands that variable and performs a checkout of the correct branch.
Steps I took
-
Create a new job
JENKINS-6856
-checkout-to-GIT_BRANCH
-
Use git as the SCM
-
Use git://github.com/MarkEWaite/git-client-plugin.git as the repository to checkout
-
Add "Additional Behavior" to checkout to a specific branch, with the value
-
Check the "Poll SCM" check box (no polling schedule needed)
-
Save the job
-
Click the "Poll Now" link on the left side of the job (assuming you have the "Poll Now" plugin installed
That series of steps resulted in immediately running 19 jobs, one for each branch in that repository. Each of those 19 jobs used a branch named precisely for the branch in the origin repository.
What it does not provide is a way to checkout a named branch which is a substring of
. I think that is what you need, and what is requested in pull request 347
There is some facility to allow substrings of GIT_BRANCH, but I was unable to make it work in the cases I was testing. The GIT_BRANCH variable is implemented inside the git plugin as a "token macro" which takes two optional arguments, fullName and all. If the fullName parameter is false, then the GIT_BRANCH value is to be returned with everything to the right of the leftmost slash character. Unfortunately, I was unable to see the token macro expanded when used in the context of "Branch to build". If I wrote it as
${GIT_BRANCH,fullName=false}
, then the GIT_BRANCH variable was not expanded.
The token macro facility needs more attention inside the git plugin (as far as I can tell), before I'd be confident saying that it works as intended.
|