How do I reference SVN revision in Bamboo Deployment Plan?
Asked by Michael Vinca:

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


Answers:
author: rsperafico
body: 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

comments: author: Michael Vinca
body: 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](/html/@C495B4504065515364EB1894F812B34C/images/emoticons/sad.png "sad")


author: Marcin Gardias
body: ${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...


author: Michael Vinca
body: 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.


author: Marcin Gardias
body: 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.


author: Michael Vinca
body: Were you able to verify?


author: Michael Vinca
body: 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.


author: Marcin Gardias
body: 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.


author: Marcin Gardias
body: The same test in 5.8.1 and it works no problem.