How do I reference SVN revision in Bamboo Deployment Plan?

It seems that ${bamboo.repository.revision.number} doesn't work like it does in a normal Plan. Is there something else I can use?

1 answer

1 accepted

0 votes
Accepted answer

Hello Michael,

Thank you for your question.

Please, add a Script task to your Deployment plan with the following:

# if Windows, uncomment the following line by removing the hash (#) character

# if Linux, uncomment the following line by removing the hash (#) character

The above will display all the environment variables that are available to your deployment.

Please, make sure you have a task to Source Code Checkout from your Subversion repository in your Deployment plan.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

So if I add a "set" command to my Windows script, I see the variable bamboo_planRepository_revision. Translating this into ${bamboo.planRepository.revision} I can use it for variable substitution in the deployment. (I have no idea why "number" gets taken off the variable name for deployment plans. I had already tried both repository and planRepository, as I believe, at least in normal Plans, they are synonymous.)

However, I cannot use this variable for Release Versioning. It does not get substituted. sad

${bamboo.repository.revision.number} is an old implementation, designed before we introduced Multiple Repositories and doesn't really work well with the feature. As in: we cannot fix it in a way that wouldn't possibly brake some users' builds. That's why it is considered deprecated and new format has been introduced. Which version are you on? I'm pretty sure repository variables can be used in release names. For that matter, plan we use to deploy our internal Bamboo server does exactly that...

We are on Bamboo 5.6.2. For our release versioning in our deployment plan we have ${bamboo.productMajorRev}.${bamboo.productMinorRev}.${bamboo.buildNumber}.${bamboo.planRepository.revision} (The first two are global variables) If I go to create a release, in "This version" I get 1.0.1418.${bamboo.planRepository.revision}. SVN is our underlying repository, if that matters.

There was significant changes to variables engine in Bamboo 5.7, so perhaps that's one of the issues that was fixed back then, because I'm quite certain it works in current version. I will verify and get back to you.

Were you able to verify?

Marcin, a little claification I found today. If I create a new release via deployment, the ${bamboo.planRepository.revision} works. It is only if I go to "Create Release" (not via deployment) directly that it doesn't substitute the information.

Hi, I just tested it in Bamboo 5.6.2 and if you click Create Release then variable is not substituted in the ui, but if I continue, the release name is created correctly.

The same test in 5.8.1 and it works no problem.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Dec 10, 2018 in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

212 views 6 8
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