Search code examples
powershellbamboo

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"

Solution

  • Typical. It's a bug.

    https://jira.atlassian.com/browse/BAM-11824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

    https://answers.atlassian.com/questions/66109/accessing-build-specific-variables-from-script-without-having-to-use-environment-variables-box-on-script-config-page

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