Are bamboo variables automatically available as environment variables?

I am trying to access Bamboo's variables as environment variables in my build script (PowerShell).

For example, this works fine in TeamCity

$buildNumber = "$env:BUILD_NUMBER"

And I expected this to work in Bamboo

$buildNumber = "$env:bamboo_buildNumber"


In the current version of Bamboo (5.x), the following environment variables work for me in Bash on an Amazon EC2 Linux client within a Bash script. It should be very similar in PowerShell.

  • ${bamboo.buildKey} -- The job key for the current job, in the form PROJECT-PLAN-JOB, e.g. BAM-MAIN-JOBX
  • ${bamboo.buildResultsUrl} -- The URL of the result in Bamboo once the job has finished executing.
  • ${bamboo.buildNumber} -- The Bamboo build number, e.g. 123
  • ${bamboo.buildPlanName} -- The Bamboo plan name e.g. Some Project name - Some plan name

You can see the full list of Bamboo build variables on the Atlassian Bamboo build variable documentation page.

Typical. It's a bug.

So I have to resort (meanwhile) to add the environment variable in the script task.

Yes, Bamboo variables appear to be available automatically as environment variables in Bamboo 5.9.4. The following worked for me as an inline Powershell:

$revision = $Env:bamboo_planRepository_revision
$buildNumber = $Env:bamboo_buildNumber
$text = "$revision - $buildNumber"
$text > 'Version.txt'

Need Your Help

Dictionary not deserializing

c# serialization binary

I'm having a problem where one Dictionary in my project is either not serializing or not deserializing. After deserializing, the data I serialized is simply not in the object.