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

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
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,798 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