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.
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).
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.
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.
It works for me do It like this:
It's bamboo.planRepository.branchName
not bamboo.repository.branch.name
And it will output this in the log:
I'm using bamboo 5.7, and if it doesn't work, it's probably because of this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With