Problem
The plan branch name could be retrieved from ${bamboo.shortPlanName} in the past, but after fixing https://jira.atlassian.com/browse/BAM-17810 this is no longer possible.
The fix was correct, but it brought up another need for a Bamboo variable to provide the plan branch display name.
None of the variables below can be used for this purpose:
- bamboo_planRepository_branchName
- bamboo_planRepository_1_branchDisplayName
- bamboo_planRepository_branchName
All the variables above will show what is configured in the repository section for the branch. if the branch is changed manually the display name will not be represented by them anymore.
It would be good if we have a variable like bamboo_branchName which returns the current Plan branch name that the job is run, in the same way before the bug fix for bamboo.shortPlanName, or bamboo.planRepository.branchName without the need to add <position> but just the current branchName that the plan is run.
Workaround (Partial)
For script task on Linux
Use bash substitution to get the branch display name from the bamboo_planName variable.
bamboo_planBranchName = ${bamboo_planName##* - }