Access branch display name as a Bamboo variable?

In git we name our feature branches "feature/whatever". When displaying branch names, Bamboo turns this into "feature-whatever". I'd like to be able to pass this "display name" into the build to use as part of a version stamp (Maven chokes when you try to pass it a slash since it wants to use the version as part of the path).

I can think of several ways to avoid the problem altogether, but I first wanted to check whether there was simply a variable I was missing that would give me the value I'm looking for.

3 answers

1 accepted

${bamboo.shortPlanName} seems to be what I was looking for, although I don't see it listed in the documentation (https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables).

I'm a little disappointed this is an accepted answer. It isn't answering the actual question of "How to get the display name" as a variable.

for whatever weird reason, bamboo.shortPlanName does seem to give the branch name with the "/" replaced by "-" . . . 

Not sure how ${bamboo.shortPlanName} gives you the branch name, that's the name of the project or build plan. But I guess if it gets what you wanted.

We obtain the branch name from ${planRepository.branchName} or ${planRepository.branch}.

Both of those variables give the "real" branch name containing the slash (feature/whatever, not feature-whatever as displayed by Bamboo). I'm by no means suggesting that behavior is wrong, it's just not what I want in this case.

I got branch name with ${bamboo.planRepository.branchName}, not ${planRepository.branch}

Understood.

Just a note, the slash "/" can be set to a dash "-" in the branch. That's configured from Stash (Branching model under repository Settings).

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,584 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you