Reputation: 31
I am executing a build which merges the changes from one branch into another(through the 'merge before build' option).
Now, I need the $GIT_BRANCH variable in my execute shell, and it gives me the second branch(into which my changes have been merged) as opposed to the earlier branch which I started out with.
Is there some way I can get the previous branch as an environment variable in my execute shell?
Thanks a lot.
Upvotes: 1
Views: 2135
Reputation: 3461
You should make a parametrized job and pass it to downstream job. For example if it's a post-build action, then you should add "Trigger parameterizied build on other projects" and add "Predefined parameters":
MY_BRANCH=$GIT_BRANCH
Then. in your downstream job you can use ${MY_BRANCH}.
Upvotes: 3