This documentation relates to an earlier version of Bamboo.
View

Unknown macro: {spacejump}

or visit the current documentation home.

When configuring a plan, you may want to specify variables to be used in the build process. There are two types of variables available to you:

  • Global variables are defined across your entire Bamboo instance, and have the same (static) value for every plan that is built by Bamboo. You can define as many global variables as you wish (see 2.4 Defining Global Variables).
  • Build-specific variables are evaluated by Bamboo dynamically at build time. The source of a build-specific variable can either be a Bamboo property or one of the default plugins (assuming they have been enabled). The following build-specific variables are available by default:

    Build-specific variable

    Source

    Description

    buildKey

    Bamboo property

    The plan key for the build, e.g. BAM-MAIN

    buildNumber

    Bamboo property

    The Bamboo build number, e.g. 123

    custom.svn.revision.number

    Plugin

    (For Subversion only) The revision number

    custom.cvs.last.update.time

    Plugin

    (For CVS only) The last updated timestamp

    custom.p4.revision.number

    Plugin

    (For Perforce only) The change set number

The usage format for all global and build-specific variables is:

${bamboo.<variable>}

Variables can be used in the following fields of your build plan:

Field

Available variables

Goal (for Maven builders only)
— see 2.1 Specifying a Plan's Build Resources

Global variables
Build-specific variables

Build File (for Ant and NAnt builders only)
— see 2.1 Specifying a Plan's Build Resources

Global variables
Build-specific variables 

Target (for Ant and NAnt builders only)
— see 2.1 Specifying a Plan's Build Resources

Global variables
Build-specific variables 

Options (for NAnt builders only)
— see 2.1 Specifying a Plan's Build Resources 

Global variables
Build-specific variables 

Script (for Scripts only)
— see 2.1 Specifying a Plan's Build Resources 

Global variables
Build-specific variables 

Argument (for Scripts and Custom Commands only)
— see 2.1 Specifying a Plan's Build Resources

Global variables
Build-specific variables 

System Environment Variables
— see 2.1 Specifying a Plan's Build Resources

Global variables
Build-specific variables

Repository URL (for Subversion repositories only)
— see 1.7 Specifying a Plan's Source Repository

Global variables

CVS Root (for CVS repositories only)
— see 1.7 Specifying a Plan's Source Repository

Global variables

Branch name (for CVS repositories only)
— see 1.7 Specifying a Plan's Source Repository

Global variables


Maven example 
For example, you may want your Maven 2 version to be determined by Bamboo. In Maven 2 pom.xml you may have:

...
  <groupId>com.atlassian.boo</groupId>
  <artifactId>boo-test</artifactId>
  <packaging>jar</packaging>
  <version>1.1.${env.bambooBuildNumber}-SNAPSHOT</version>
...

You can then specify the following in the 'Goal' field of your build plan:

clean package -DbambooBuildNumber=${bamboo.buildNumber}

When the command runs, Bamboo will replace the buildNumber with the actual number (e.g. 1102), which will be passed to the underlying Maven build to use. The command will then produce a jar that looks like this: boo-test-1.1.1102-SNAPSHOT.jar.