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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

137 views 2 0
Join discussion

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