1.2.1 Using Custom Variables

All Versions
Click for all versions
Bamboo 1.1 Documentation

Index

Since Bamboo 1.1, you can add variables in your build command that Bamboo will evaluate at build time.

To add a custom variablem use the following format: ${bamboo.<your_variable>}. The source of the variable can either be one of the default plugins (see 9.1 About Bamboo Plugins for a list) or a global variable value (see 2.3 Configuring Global Variables for more information).

By default you can use the following properties (prefix them with bamboo):

Property Description
buildKey The plan key for the build, e.g. BAM-MAIN
buildNumber The Bamboo build number, e.g. 123
custom.svn.revision.number (For Subversion only) The revision number
custom.cvs.last.update.time (For CVS only) The last updated timestamp
custom.p4.revision.number (For Perforce only) The change set number

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 ${bamboo.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.

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.