How to create a unique semantic version number across plan branches with one plan

I'm looking for a way to create a unique semantic version number across multiple plan branches within one plan. E.g. I have a plan to build Git feature branches. I want each feature being built to get a unique version number. I was using the following setup first:

${bamboo.alphaVersion}-alpha${bamboo.buildNumber}

The alphaVersion is set manually (e.g. related to a development sprint). The problem with this, though, is that each plan branch starts its own build numbering and thus we will have overlapping version numbers. 

I have tried postfixing the number with

-${bamboo.planRepository.revision}

but this makes the the version number too long, since we're using Octopus Deploy which will only accept version numbers with a maximum length of 20 characters. This could only be a viable solution if I was able to use a substring of this variable's value. But that seems impossible in Bamboo.

I hope someone can help!

2 answers

1 accepted

1 vote
Accepted answer

Thanks for your feedback, Xabier. I have been diving a bit more into this and ended up in using the following format for now: 

${bamboo.alphaVersion}-${bamboo.inject.jiraIssueNumber}${bamboo.buildNumber}

I have indeed used the "Inject Variables from file", with a script to extract the JIRA issue number from the branch name, as described in my related question here.

The other annoying part of this, is that Bamboo generates its own release number following a non-customizable format. But at least the whole chain works now.

I have been fighting with similar issues for a while, my solution so far is to add the branch name to the version:

<PRODUCT_NAME>-X.Y.X_<BRANCH>+buildBBBB

That is

product-1.2.3_FEAT-456_build0876

Not sure this will end up fitting in 20 chars anyway.

Other possible option would be, in the first job of your build, trim the revision number, save it to a file, and inject the variables , defining the scope as the full plan. A bit cumbersome, I know

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

5,015 views 20 14
View question

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