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"
Plan variables can be accessed by using ${ bamboo. varName }. Plan variables can also be overridden at runtime when running a manual build. For more information, see Running a plan build manually.
For task configuration fields, use the syntax ${bamboo. myvariablename}. For inline scripts, variables are exposed as shell environment variables which can be accessed using the syntax $BAMBOO_MY_VARIABLE_NAME (Linux/Mac OS X) or %BAMBOO_MY_VARIABLE_NAME% (Windows).
To access the Global variables page:From the top navigation bar select > Build resources > Global variables. Add, update, or delete the global variables, as desired: Add a new variable once you have entered the key and value for it. Updates to existing rows will be saved as you move between cells in the table.
The Working Directory is where Bamboo temporarily puts the checked-out files it is building. The location of this directory was specified using the Setup Wizard, can be viewed as described in Bamboo's system information, and can be changed as described below.
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With