Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Branch Name in Bamboo Deployment Plan

Tags:

bamboo

How can I get the branch name in a script for a deployment plan in bamboo? The variables listed in the documentation show that we can use bamboo.repository.branch.name, but that doesn't seem to work in a deployment plan.

like image 598
K2xL Avatar asked Mar 18 '15 21:03

K2xL


People also ask

How do I get bamboo variables in script?

For task configuration fields, use the syntax ${bamboo. myvariablename}. For inline scripts, variables are exposed as shell environment variables which can be accessed using the syntax $BAMBOO_MY_VARIABLE_NAME (Linux/Mac OS X) or %BAMBOO_MY_VARIABLE_NAME% (Windows).

What is Bamboo buildNumber?

bamboo.buildNumber. The build result from which the release is created. bamboo.buildResultKey. The key of the build result from which the release is created e.g. KUNG-FOO-35. bamboo.planKey.

How do I change the default branch in bamboo?

If you go to the Administration cog and select "Linked Repositories". This will bring you to a listing of all BitBucket repositories you have linked in Bamboo. Then select the repository that you which to change the default branch for and my screenshot should make sense from there.


1 Answers

It works for me do It like this:

It's bamboo.planRepository.branchName not bamboo.repository.branch.name

Configuration

And it will output this in the log:

Log1Log2

I'm using bamboo 5.7, and if it doesn't work, it's probably because of this issue.

like image 75
bhathiya-perera Avatar answered Oct 09 '22 08:10

bhathiya-perera