Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Why is the variable automatically substituted?

I try to use the variable ${} in further tasks, but it's always substituted with name of the same branch.

I push on "Branch", the variable has the value "Branch".

I push on "Master", the variable has the value "Branch"... but normally it should have the value "Master", shouldn't it?

Is there another variable to figure out the name of the branch to which something was pushed?

1 answer

1 vote


Yes you need to use branch variable stated in the documentation. What you are using is repository name variable.

Check out bamboo.planRepository.<position>.branchName variable.



bamboo.planRepository.<position>.branchName uses static values.

f.e. bamboo.planRepository.1.branchName=master and



But I need a variable which changes its value depending on the branch it's pushed to.

Jimmy Seddon Community Leader Dec 06, 2019

Hey @DavidJng,




are not different branches with the same repository they are the current branch from two linked repositories in your Build Plan (that is assuming that when your Build Plan executes, you are checking out code from two repositories).

If you use: ${bamboo.planRepository.1.branchName} when pushing to master it will substitute with the value 'master'

If you use ${bamboo.planRepository.1.branchName} when pushing to test_branch it will substitute with the value 'test_branch'

I hope that helps!


Like Elifcan Cakmak likes this

Hi @Jimmy Seddon
I always want to checkout everything. But in further tasks I only want to use the branch where something was pushed from. 


  1. Push on "test-branch"
  2. Checkout "master" and "test-branch"
  3. use "test-branch" in further tasks 


  1. Push on "master"
  2. Checkout "master" and "test-branch"
  3. use "master" in further tasks


Best regards,

Jimmy Seddon Community Leader Dec 09, 2019

Hi David,

That's not exactly how Source Code checkout tasks work in Bamboo:

You will only be checking out a single branch per repository at any given time.  But that's precisely how bamboo.planRepository.1.branchName is able to correctly identify the branch you have checked out.

If you are attempting to try and use some other method to checkout multiple branches at the same time, can you describe in a bit more detail what you are using to accomplish this?


Hi Jimmy,

Given the following example:


If a user pushes something on test-branch1, I want to read a properties file inside test-branch1 and inject them. 

Also I want to do the same for test-branch2 and master without using the Bamboo branch-plan feature.

Best regards,


Jimmy Seddon Community Leader Dec 09, 2019

Hi David,

As I stated previously, Bamboo doesn't handle trying to checkout from multiple branches for the same repository at the same time.  From what you have described as far as what you want to accomplish it really sounds like 'test-branch1' & 'test-branch2' should be the master branches of their own repositories, and then you would link all three repositories in your build plan.  That way when someone makes a change in repo 'test-branch1' you will automatically pull the repo for test-branch2 (and it's configuration).

That's just my two cents.


Like DavidJng likes this

Hi Jimmy,
I understood, thanks!

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events