Using a bamboo variable in git repository branch configuration

Is there any way to use a bamboo variable for the branch name when configuring a source repository?

I would like to be able to specify the tag name to fetch in a variable when releasing a version from JIRA.

2 answers

0 votes

You can use variables in the repository configuration, but the caveat is, the repository configuration needs to resolve to sth. that exists.

So if the tag already exists when you trigger the build it should work.

But if you create the tag during the build it won't work, as Bambo will try to find the revision on tag that not exists yet.

There might be a workaround but I haven't tried that:

- define repository with a variable in branch field

- set that variable to 'master' (or whatever that works)

- before checking out, use this Task: https://marketplace.atlassian.com/plugins/com.atlassian.bamboo.plugins.bamboo-variable-inject-plugin to change the value of the variable

I created the tag in the stash repository before doing the release from JIRA. I tried to run the release with the repository branch name set to ${bamboo.jira.version} but it didn't seem to parse the variable, saying it couldn't find the branch '${bamboo.jira.version}'. I tried the same with a custom Plan Variable but got the same result.

Yes. We use a variable called git.branch.name and use it as ${bamboo.git.branch.name} in the branch area

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

5,372 views 21 17
View question

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you