Are bamboo variables automatically available as environment variables?

Adam B picture Adam B · Apr 13, 2013 · Viewed 19.8k times · Source

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"

Answer

Steve HHH picture Steve HHH · Nov 21, 2013

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.