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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,463,601
Community Members
 
Community Events
176
Community Groups

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

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:

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

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.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events