It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Answer 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
Community showcase
Published in Bamboo

Unable to add or edit Bitbucket Cloud repository in Bamboo

On 31 May, a GDPR-related change went live in the Bitbucket Cloud API that resulted in users not being able to create or edit Bitbucket Cloud Linked repositories in Bamboo. This API update removed t...

449 views 2 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you