How to update (increment) a plan-level (or higher) variable?

I'm using Bamboo plan branches. These are deployed through Octopus Deploy. The latter expects a unique release number with every deploy. Bamboo offers auto incrementing for releases of regular branches but not for plan branches. This is a true pain. 

The only solution I see is to have a plan-level (or higher will do too) variable that I can increment and update with every deployment. But so far I have tried:

  1. to update a regular Bamboo variable
  2. to write the variable to a globally accessible file with Powershell, but the scope of a script is the current deployment directory
  3. to use system variables, but I wasn't able to write to these from script either

Is any of this possible and if so: how? Or is there a better solution to my core problem?

Thanks, Pascal

 

1 answer

1 accepted

Yes! I got it to work using the Variable Task add-on for Bamboo. Here's how I set it up:

  1. Create a plan-level variable, e.g. 
    Plan_level_variables.png
    Add_plan_variable.png


  2. Add a "Version Variable Incrementer" deployment step with the following configuration:
    Version_Variable_Incrementer.png 
  3. Use the variable ${bamboo.release_sequence_number_for_plan_branches} in subsequent steps, e.g. in the release numbering for Octopus Deploy:

    create-release --project "Test" --releaseNumber ${bamboo.alphaVersion}-alpha-${bamboo.inject.jiraIssueNumber}-${bamboo.buildNumber}-${bamboo.release_sequence_number_for_plan_branches} --packageversion ${bamboo.alphaVersion}-alpha-${bamboo.inject.jiraIssueNumber}-${bamboo.buildNumber} --ignoreexisting --server http://localhost:8090/ --apiKey ${bamboo.OctopusApiKey_Password} --releaseNotes "${bamboo.inject.jiraIssueNumber}"

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