How can I set different bamboo variable value for automaticaly created branches (using regexp release/.+)

This question is in reference to Atlassian Documentation: Using plan branches

I have plan targeted to develop branch in git. In bamboo I set automatical creating branches for regexp release/.+

Develop branch I need build with maven profile dev but for all of releases branches need build with prod maven profile.

I have one bamboo variable with maven profile, which is set to dev for dev branches, prod for one master branch. When new release branch is created on bamboo, the variable is set to dev as in plan. 

2 answers

1 accepted

1 vote

This might be not the simplest way but it might just work for you:

  • create script task that compares bamboo built-in variable ${bamboo.planRepositories.branchName} with the regexp
  • the script should create .properties file that defines proper maven target according to the comparison's result
  • you can then inject the properties from the file into the build using Variables Inject Task (bundled with Bamboo)
  • re-configure maven task to use injected variable.

Thank you Marcin.

Your solution is little bit complicated but looks acceptable for me. I will try it.

Libor

Thanks.

It is working very well.

I would set a different release plan for production to the dev plans and follow the instructions on https://confluence.atlassian.com/bamboo/naming-versions-for-deployment-releases-361726798.html to set the naming convention for each.

I would to have only one plan for one component/library.

image2016-1-19 12:4:0.png

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,568 views 0 6
Read article

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