How can I dynamically set a plan variable in a task in Bamboo?

I need to set a variable in my Bamboo plan based on a field in my POM. This variable will then by used by the next task. How can I achieve this?

The full scenario is: I have a plan that branches my project for release. Currently I use two variables to hold the branch name and the next development version number, which is set manually using Run Customised. However if I can read the version number from the pom.xml file, these values can be calculated. So ideally I would like to use a script to:

  1. read the pom.xml file
  2. extract the current version number
  3. manipulate it to determine the branch name and next version, and
  4. populate two variables to be used by the branching task.

I have looked at the plugin exchange and all that seems promising for this is the Groovy plugin, but this does not seem to work on 4.0 and even then I don't know how to set a plan variable from the script. I'd prefer not to write a custom task for this unless there is really no other way.

Any help would be greatly appreciated

1 answer

1 accepted

EDIT: Take a look at the Inject Bamboo variables from file Task in Atlassian Labs.

Hi Andre,

There is an improvement request open to implement a Task that can read keys and values from a properites file and turn them into Bamboo variables. Would this work? If so, please vote for it.

There isn't a good way of doing this short of writing your own Task for the moment.

Thanks

James

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
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,096 views 0 5
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot