Include system variable in global variable

Is it possible to create a new global variable which includes a system variable?

For example, I want to create a global variable for MSBuild options that I can use with each of my projects. In this global variable, I want to reference ${bamboo.buildnumber}. When I include the system variable, it does not get evaluated though. It's coming through as -Version "1.0.${bamboo.buildNumber}"

Is there a way to have this evaluated?

3 answers

1 accepted

This widget could not be displayed.

You could potentially just use 2 variables... use the global variable for the first 2 numbers of your version number, and then use the ${bamboo.buildNumber} as the 2nd variable...

so in your scripts or where you pass arguments instead of passing in a single bamboo variable for the version, you can just concat 2 of them together


That's what I ended up doing, and that worked as I wanted. Thanks.

This widget could not be displayed.

I am assuming that you have a build script that is a part of your repositor that you are executing. If you have the ${bamboo.buildNumber} in there, then it will not be resolved.

The ${bamboo.buildNumber} variable will be resolved when you pass it in as an argument to your script when your task executes it, or if you use inline scripting option as a task.

It's not a script. In Bamboo, I go to Administration->Global Variables and add the variable with text "/p:Version=1.0.${bamboo.buildNumber}". Then I go to my Plan->Configure Plan->Stages->Default Job->Tasks->MSBuild, and enter ${bamboo.myMsBuildOptions} in the Option text box. The string that gets passed to MSBuild includes the variable NAME ${bamboo.buildNumber} , not the variable value. This does NOT get parsed into "1.0.43" like I'd expect.

This widget could not be displayed.

What you'd need is nested evaluation of variables, which is not supported atm. You can create an improvement request for it here: .

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

256 views 1 3
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