Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Pascal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2015

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
Answer accepted
Pascal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 9, 2015

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.

3 votes
Xabier Davila January 8, 2015

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
TAGS
AUG Leaders

Atlassian Community Events