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


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
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

953 views 3 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you