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

2 votes
Accepted answer

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
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

71 views 0 3
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