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

Overriding build-specific variables in Bamboo plans


I have 2 repositories in 1 plan where repo1 is the default repo and repo2 is non default. The way Bamboo plans work is the default repo is able to checkout to specific branches, but the non-default can only checkout to master. I am trying find a way around this so that I can pass in a plan variable to repo2 that sets it to what branch I want.This is what I've experimented with so far:

1. Added a plan variable

I override this on a manual build

Screen Shot 2018-03-18 at 11.26.23 AM.png

2. Passed in the plan variable into the script


this tells you branch info when you echo it out.

So I tried doing this but didn't work:

Screen Shot 2018-03-18 at 11.40.05 AM.png

What is the correct way to override build-specific variables in Bamboo?

3 answers

1 vote

What you seem to be after is this feature: which has been delivered in Bamboo 6.3.0

0 votes
Foong Atlassian Team Apr 09, 2018

Variable is only used for Subversion repository when Bamboo perform Source Code Checkout task. It is not being used in other repository types.

Your requirement for Source Code Checkout task to checkout specific branch for other non default repositories has been implemented in Bamboo 6.3.0:

Not sure what you are trying to do but you can get the branch name from the system variable named:


where position is an optional parameter that specifies the position of the repository in the plan's repository list. If omitted, the first repository in the list is used.

If you are trying to set a variable, why do you want to override a bamboo variable? Why not define a new one?


and then use ${plan_branch} in the next steps?

Yeah corect this is a system variable:


And that translates in the task script as:


And I want to override a different branch to that system variable like my example in the description.

Reason for this is it is a non-default repo, so only master is checked out all the time

Those variables are _derived_ from your build configuration, they are not meant to be reset and changing their value won't have any effect other than, well, their value is now changed.

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...

933 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