Available variables in plan trigger script

https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html

Build-specific variables

Build-specific variable

Description

Availablity

Build-specific variable

Description

Availablity

bamboo.buildKey

The job key for the current job, in the form PROJECT-PLAN-JOB, e.g. BAM-MAIN-JOB

This is related to a job. There may be more than one job hence it’s not meaningful for our deployment trigger to provide such variable and too early for our plan trigger.

bamboo.planKey

The key of the current plan, in the form PROJECT-PLAN, e.g. BAM-MAIN

bamboo.shortPlanKey

The short key of the current plan (without project part), e.g. MAIN

bamboo.shortJobKey

The short key of the current job (without project and plan parts), e.g. JOBX

This is related to a job. There may be more than one job hence it’s not meaningful for our deployment trigger to provide such variable and too early for our plan trigger.

bamboo.buildResultKey

The result key when this job executes, in the form PROJECT-PLAN-JOB-BUILD e.g. BAM-BOO-JOB1-8, where '8' is the build number. For deployment projects this variable will not have the JOB component e.g. PROJ-TP-6.

This is related to a job. There may be more than one job hence it’s not meaningful for our deployment trigger to provide such variable and too early for our plan trigger.

bamboo.buildResultsUrl

or

bamboo.resultsUrl

The URL of the result in Bamboo once the job has finished executing.
http://example.com/bamboo/browse/DP-PT-JOB1-486

This URL is related to a job. There may be more than one job hence it’s not meaningful for our deployment trigger to provide such variable and too early for our plan trigger.

bamboo.buildNumber

The Bamboo build number, e.g. 123

Not available for plan trigger
Available for deployment trigger

bamboo.buildPlanName

The Bamboo job name e.g. Some Project name - Some plan name - Some job name

This is related to a job. There may be more than one job hence it’s not meaningful for our deployment trigger to provide such variable and too early for our plan trigger.

bamboo.planName

The current plan's name e.g. Some project name - Some plan name

bamboo.shortPlanName

The current plan's name without project part, e.g. Some plan name

bamboo.shortJobName

The current job's name without project and plan parts, e.g. Some job name

This is related to a job. There may be more than one job hence it’s not meaningful for our deployment trigger to provide such variable and too early for our plan trigger.

bamboo.buildTimeStamp

The time when build was started in ISO 8601 format e.g. 2010-01-01T01:00:00.000+01:00

This information is not available because it’s too early for our plan trigger.

Available in deployment trigger

bamboo.agentId

The ID of the agent that the deployment is executed on.

Not available for plan trigger and not meaningful for deployment trigger (In deployment trigger we could know the agent(s) that run the jobs).

bamboo.agentWorkingDirectory

The path to the working directory on the agent, for example <HOME>/xml-data/build-dir.

The agent working directory is not the same as the build working directory described below.

Not available for plan trigger and not meaningful for deployment trigger (In deployment trigger we could know the agent(s) that run the jobs).

There are separate working directories for each agent.

bamboo.build.working.directory

The working directory on which the build is being executed, for example <HOME>/xml-data/build-dir/AV-AVT-JOB1.



Not available for plan trigger and not meaningful for deployment trigger.

There are separate working directories for each job.

bamboo.ManualBuildTriggerReason.userName

The user who triggered the manual build.

Not available for plan trigger

Available for deployment trigger

Generic repository variables



 

bamboo.planRepository.<position>.branchName

The name of the branch in the repository (depends on availability from the VCS used) e.g. default

 

bamboo.planRepository.<position>.name

The name of of the repository, as shown in the repository for the plan e.g. Mercurial

 

bamboo.planRepository.<position>.revision

The revision use to build this release. Format depends on the VCS used.

 

bamboo.planRepository.<position>.previousRevision

The previous revision number (this might not exist, for example for the initial build).

 

bamboo.planRepository.<position>.type

The type of the repository, as defined by a repository plugin e.g. hg, svn, git

 

bamboo.repository.pr.key

Pull request key if plan branch was created from pull request

 

bamboo.repository.pr.sourceBranch

Pull request source branch name if plan branch was created from pull request

 

bamboo.repository.pr.targetBranch

Pull request destination branch name if plan branch was created from pull request

 

Subversion



 

bamboo.planRepository.<position>.username

User name, used for repository authentication.

 

bamboo.planRepository.<position>.repositoryUrl

The repository URL.

 

CVS



 

bamboo.planRepository.<position>.last.update.time

The last updated timestamp.

 

bamboo.planRepository.<position>.last.update.time.label

The last updated timestamp to be used as a label for post build result labeling. The spaces in the cvs version string are replaced with '_'.

 

Perforce



 

bamboo.planRepository.<position>.revision.number

The change set number.

 

bamboo.planRepository.<position>.username

User name, used for repository authentication.

 

bamboo.planRepository.<position>.port

Port used for repository communication.

 

bamboo.planRepository.<position>.client

Client used for repository communication.

 

Git



 

bamboo.planRepository.<position>.branch

The branch

 

bamboo.planRepository.<position>.repositoryUrl

The repository URL

 

Mercurial



 

bamboo.planRepository.<position>.repositoryUrl

The repository URL

 

bamboo.planRepository.<position>.branch

The branch

 

bamboo.planRepository.<position>.username

User name, used for repository authentication.

 

Build dependency variables

Build-specific variable

Description

Build-specific variable

Description

bamboo.dependency.parent.#

Allows a child build to query the build key of the triggering parent build, where # represents the position in the build tree - 0 at the top, 1 the following, and so on. The ${bamboo.dependency.parent.0} variable can be viewed in the child plan's metadata tab.

bamboo.dependency.parent.total

The total # of parent builds.

Deployment Variables

Variable

Description

Availablity

Variable

Description

Availablity

bamboo.agentId

The id of the agent that the deployment is executed on.

bamboo.agentWorkingDirectory

The path to the working directory on the agent. This is not the same as the Bamboo working directory.

bamboo.build.working.directory

The path to the working directory for Bamboo. This is used by both the build plan and the deployment project.

bamboo.deploy.environment

The name of the environment that the release is to be deployed to.

environment.getName()

bamboo.deploy.project

The name of the deployment project.

bamboo.deploy.rollback

True if the release being deployed is older than the release being replaced.

bamboo.deploy.release

bamboo.deploy.version

The name of the release that is being deployed. Either .release or .version can be used - both return the name of the release being deployed.

bamboo.deploy.release.previous

bamboo.deploy.version.previous

The name of the release that is being replaced (if available). Either .release or .version can be used - both return the name of the release being replaced.

bamboo.resultsUrl

The URL to the screen in Bamboo that displays build results.

Releases variables

Variable

Description

Availability

Variable

Description

Availability

bamboo.buildNumber

The build result from which the release is created.

Not available for plan trigger
Available for deployment trigger

bamboo.buildResultKey

The key of the build result from which the release is created e.g. KUNG-FOO-35

Not available for plan trigger
Available for deployment trigger

bamboo.planKey

The key of the plan related to the release e.g. KUNG-FOO

Available for plan trigger
Available for deployment trigger

bamboo.planName

The name of the plan related to the release e.g. Kung - Foo

Available for plan trigger
Available for deployment trigger

bamboo.shortPlanKey

The short key of the plan related to the release (without project part), e.g. MAIN

Available for plan trigger
Available for deployment trigger

bamboo.shortPlanName

The plan's name without project part, e.g. Some plan name

Available for plan trigger
Available for deployment trigger

System variables

The usage format for all system variables is:

${system.<variable>}

Jira applications variables

Note that these variables can be accessed from a Bamboo build only when that build was triggered by releasing a version in Jira Software Server.

Jira variable

Description

Jira variable

Description

${bamboo.jira.baseUrl}

The URL of your Jira application server.

${bamboo.jira.projectKey}

The key of the triggering Jira application project.

${bamboo.jira.projectName}

The name of the triggering Jira application project.

${bamboo.jira.version}

The release version of the triggering Jira application project.

${bamboo.jira.username}

The username of the user who triggered the release build.