It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Overriding build-specific variables in Bamboo plans Edited

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

$bamboo_planRepository_2_branch 

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: https://jira.atlassian.com/browse/BAM-11544 which has been delivered 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:

bamboo.planRepository.<position>.branchName

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?

plan_branch=${bamboo.repo2_branch}

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

Yeah corect this is a system variable:

bamboo.planRepository.<position>.branchName

And that translates in the task script as:

$bamboo_planRepository_2_branch 

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.

0 votes

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:

https://confluence.atlassian.com/bamboo/bamboo-6-3-release-notes-941616828.html#Bamboo6.3ReleaseNotes-Branchingwithmultiplerepositories

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Unable to add or edit Bitbucket Cloud repository in Bamboo

On 31 May, a GDPR-related change went live in the Bitbucket Cloud API that resulted in users not being able to create or edit Bitbucket Cloud Linked repositories in Bamboo. This API update removed t...

663 views 2 7
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