How do I reference SVN revision in Bamboo Deployment Plan?

Michael Vinca May 19, 2015

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
Answer accepted
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 20, 2015

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
#env

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

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

Michael Vinca May 20, 2015

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

Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 20, 2015

${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...

Michael Vinca May 20, 2015

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.

Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 20, 2015

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.

Michael Vinca June 3, 2015

Were you able to verify?

Michael Vinca June 5, 2015

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.

Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2015

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.

Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2015

The same test in 5.8.1 and it works no problem.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events