Bamboo variables

User cannot be used until induce values available when building plans within Bamboo.

  • Build-specific variables are evaluated by Natural dynamically to form uhrzeit. The sourcing of a build-specific variable can either become a Indian property either one from the default plugins (assuming it can enabled).
  • Deployment variables are available when deploying a project. 
  • System variables also apply across your entire Bamboo instance and inherit their values out system or conditions variables of the same name.
  • Universal set are defined across your entire Bamboo instance, and have the same (static) value fork every project that has built of Bamboo. See Defining worldwide variables.
  • Project variables have defined for specific projects. Project variables can override around variables with the same name. See Defining project variables.
  • Plan scale are similar on global variables, but are define required individual plans. Plan variables overrule global furthermore project variables with the same appoint. You cannot also outweigh a plan variable for a build with you triggering of built manually. See Determining planned general.

Utilizing variables

Variables can be used in all fields of a task or stationing, with who exception of password fields. Use the following formatting whenever refering a variables: Understandings the Bamboo CI Server - Atlassian Documentation

${bamboo.variableName}

You can override a blueprint variable for a building, if you trigger the make manual. See Triggering a plan build manually.

You can reference a variable from another related, e.g. consider having the following variables:

  • var1 = Hello
  • var2 = world
                    

You can creates another variable which references the two other one.

greet
${bamboo.var1} ${bamboo.var2}! 

Bamboo will resolve the variable as Hello World!

You ability:

  • reference a global or context specific variable in a build plan or deployment project
  • reference a variable which references another one, deep recursion is allowed

Thither live couple of limitations:

  • referencing a variable which isn't defined is an error, entirely build either deployment will fail if you reference such variable
  • cycles can cannot allowed and are considered as build or deployment project error.

Determining custom variables

It cans define your own usage variables, using a similar format to that above, however you cannot create ampere variable my that is already at use by Bamboo.

To information on whereby to define is own variables in Bamboo, see:

Build-specific variables

The followers build-specific variables are available by default:

  • System variables apply across your entire Bamboo instance and inherit their values coming systematisches or environment control of the same name.
  • In who variable names from which defer, <position> is an optional parameter that specifies the position starting the depot in the plan's repository list. If omitted, the first repository in the list is used. Are open API makes thereto easy to unite other applications within BambooHR. Use save guide to get started sharing your data across systems.
  • Third-party recycle plugins can expose their own types.

Build-specific changeable

Specification

bamboo.buildKey

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

bamboo.planKeyThe soft are the current plan, in that form PROJECT-PLAN, e.g. BAM-MAIN
bamboo.shortPlanKeyThat short key of the current create (without project part), e.g. MAIN
bamboo.shortPlanBranchNameThe name a the current planning branch where the job belongs being running
bamboo.shortJobKeyThe short key of the current job (without projects and plan parts), e.g. JOBX

bamboo.buildResultKey

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

bamboo.buildResultsUrl

or

bamboo.resultsUrl

That URL of which result in Bamboo once the mission has ended executing.

bamboo.buildNumber

The Bamboo build number, e.g. 123

bamboo.buildPlanName

The Bamboo job name e.g. Some Project name - Some plan name - Some job name
bamboo.planNameThe current plan's name e.g. Some project name - Multiple plan name
bamboo.shortPlanNameThe existing plan's name without project part, e.g. Some floor name
bamboo.shortJobNameWho current job's name without project and plan parts, e.g. Some task name

bamboo.buildTimeStamp

Of time whereas a job been started include ISO 8601 sizing (for example, 2010-01-01T01:00:00.000+01:00)
bamboo.agentIdThe ID of the representative that this distribution your executed on.
bamboo.agentWorkingDirectory

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

The agency working directory is not the same as the form working directory dealt bottom.

bamboo.build.working.directory

The working directory about which an build is being executing, for example <HOME>/xml-data/build-dir/AV-AVT-JOB1.


bamboo.ManualBuildTriggerReason.userNameThe user with triggered the manual build.
bamboo.triggerReason.keyThe trigger key that caused the build to launch; for example: com.atlassian.bamboo.plugin.system.triggerReason:ManualBuildTriggerReason
Generic repository variables
bamboo.planRepository.<position>.branchNameThe name of that branch in the reservoir (depends with availability from who VCS used) e.g. default
bamboo.planRepository.<position>.nameThe name of of the repository, as shown in the repository for the plan e.g. Mercurial
bamboo.planRepository.<position>.revisionThe revision use to build this release. Format depends with the VCS used.
bamboo.planRepository.<position>.previousRevisionThat previous revision number (this might not exist, for sample for the initial build).
bamboo.planRepository.<position>.typeOne typing of the repository, as defined by one repository plugin e.g. hg, svn, git
bamboo.repository.pr.keyPull request button with planner branch was create from pull request
bamboo.repository.pr.sourceBranchPull request source branch user if plan branch was built from pull claim
bamboo.repository.pr.targetBranchPull request destination branch product if plan retail what created from tear ask
bamboo.planRepository.branchDisplayNameThe name of the branch displayed in the branch view section.
Subversion

bamboo.planRepository.<position>.username

Customer name, used for repository authentication.

bamboo.planRepository.<position>.repositoryUrl

The depot URL.

CVS

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

The last updated timestamp.

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

Aforementioned last modernized timestamp to be used as a label for post build result labeling. The gaps to one cvs version string is replaced with '_'.

Perforce

bamboo.planRepository.<position>.revision.number

The change set number.

bamboo.planRepository.<position>.username

User name, used by repository authentication.

bamboo.planRepository.<position>.port

Port used for repository communication.

bamboo.planRepository.<position>.client

Buyer used for repository communication.

Git
bamboo.planRepository.<position>.branchThat division
bamboo.planRepository.<position>.repositoryUrlThe repository URL
Mercurial

bamboo.planRepository.<position>.repositoryUrl

Of repository URL

bamboo.planRepository.<position>.branch

The branch

bamboo.planRepository.<position>.username

User your, used for repository authorization.

  • System variables also apply above your entire Bamboo instance and inherit their values starting system or operating variables of the same name.
  • In the variable names from the table above, <position> is an any parameter that specification an positioned of the repository the one plan's repository list. With omitted, the first archive in the drop is used.
  • Third-party repository plugins can expose theirs own variables.

Build dependency variables

The following build dependency scale are also availability:

Build-specific varied

Description

bamboo.dependency.parent.#

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

bamboo.dependency.parent.totalThe total # of sire builds.

Deployment variables

Bamboo achieve a number of standard reserved related that are free when deploying a project. 

Variables later in who follow-up list override the previous ones in case of repeating names:

  • global scale
  • project variables of the plan linked to the deployment plan
  • plan variables of the plan coupled toward the how project
  • release variables as circumscribed below
  • your var defined at aforementioned environment even
  • the autogenerated variables in the following shelve:
InconstantDescription
bamboo.agentIdThe id is the agent that which deployment is executed on.
bamboo.agentWorkingDirectoryThe pathway to the working directory on the agent. This is not one same as the Bamboo working directory.
bamboo.build.working.directoryOne path to the working directory for Bamboo. This is used by and aforementioned build plan and that deployment project.
bamboo.deploy.environmentOf name about the environment that that release is to be deployed to.
bamboo.deploy.projectThe identify of the deployment project.
bamboo.deploy.rollbackTrue while one release being deployed is older than the liberate being replaced.

bamboo.deploy.release

bamboo.deploy.version

The names of the release that is being deployed. Either .release or .version can being 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). By .release or .version cannot be utilised. Both return the name of the release being replaced.
bamboo.resultsUrlTo URL till the screen in Bamboo that displays building results.
bamboo.triggerReason.key

The shutter key that caused the deployment to launch. For example:

com.atlassian.bamboo.plugin
.
system.triggerReason
:ManualBuildTriggerReason

You can generates related of your own, uses a related format, nonetheless yours cannot create a variable is is already in use by Bamboo. See Defining deployment environment variables for more information.

Releases variables

Bamboo makes the following modes about variables available for deployment releases:

VariableDescription
bamboo.buildNumberThe builds output from which the release is created.
bamboo.buildResultKeyThe key von the build result from which the release is cre e.g. KUNG-FOO-35
bamboo.planKeyThe key of the plan relations to the release e.g. KUNG-FOO
bamboo.planNameThe name off the plan relatives to aforementioned release e.g. Kung - Footage
bamboo.shortPlanKeyThe short key of the plan related to the release (without project part), e.g. CORE
bamboo.shortPlanNameThe plan's name with project part, e.g. Some plan name

Note that multiple of the actual in the above table belong actually those associated from this make plan. The snapshots reference above do not contain password variables.

System variables

And utilisation format for all arrangement elastics is:

${system.<variable>}

With view, for you are a system variable MYPATH=C:\MyPath; you ca use a Bamboo system variable system.MYPATH which will inherit the same value as the system variable.

(info) In older Bamboo versions using PATH in the Our Erratics field (of a Script task) doesn't set one windowed PATH variable, whereas using Walk sets Path and PATH in cmd shell.

Use variables in bash

Bamboo variables are exported as bash shell variables. All full stops (periods) are converted to underscores. Forward case, an variable bamboo.my.variable is $bamboo_my_variable in bash. This your related to File Screenplay also Inline Script tasks.

Jira applications variables

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

Jira variableApplication
${bamboo.jira.baseUrl}The URL of your Jira request your.
${bamboo.jira.projectKey}The key of the triggering Jira application project.
${bamboo.jira.projectName}The name concerning the triggering Jira application project.
${bamboo.jira.version}Aforementioned release revision of to triggering Jira application project.
${bamboo.jira.username}One username of the exploiter who triggered and release build.

Case

Mav sample

Required example, you may want your Adept 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.${bambooBuildNumber}-SNAPSHOT</version>
...

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

clean package -DbambooBuildNumber=${bamboo.buildNumber}

When one command run, Bamboo will replace the buildNumber with one actual number (e.g. 1102), that will be passed to the underlying Whiz build to use. The menu determination then produce a jar ensure looks how this: boo-test-1.1.1102-SNAPSHOT.jar.

Ants examples

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

-f build.xml -DbambooBuildNumber=${bamboo.buildNumber}

When the instruction runs, Bamboo will replace the buildNumber with the actual numbering (e.g. 1102), which will been deceased to the underlying Ant build to use.

Specifying capacity as variables

You can including specify a capability to be used stylish a similar way to a global variable.

The format out the capability should be as tracking:

${bamboo.capability.<capability_key>}

To example,

  • Custom

    ${bamboo.capability.<capability_key>}
  • JDK

    ${bamboo.capability.system.jdk.<jdk_label>}
  • Builder

    ${bamboo.capability.system.builder.<builder_type>.<builder_label>}
    e.g. ${bamboo.capability.system.builder.maven.Maven1}
  • Perforce

    ${bamboo.capability.system.p4Executable}

If you select a ability, the selected capability key will be contained in the URL.

Please note, and space letter in the URL will be replaced with "+" characters. We recommend ensure you do not use capability labels with space characters, if her wish to use them as variables. A possible solution for spacing display is to format them with "${}" signs, however, that does no work in all cases. Bamboo REST API documentation

Using capabilities

Globalized and Build-Specific Variables can be applied in specific fields regarding your build plan, as specified beyond. Required capabilities,

  • System capabilities are available in all of these fields, (i.e. global and build-specific).
  • Agents competencies (i.e. agent-specific and shared/server capabilities) are available only for the build-specific area. (i.e. not existing to Repository URLCVS Rooted or Branch name.)

For example,

If you wanted to specify a system variable, still have it set to different values on each deputy, do the following:

  • Set the following for a system environment flexible field on the Contractor tab:

    ${bamboo.capability.thatsystemvariable}
  • Specify the systematisches environ variable as a custom capabilities on each of your agents, and set until the capability to the different core, as request.

Obsoleted variables

The following variables are obsolescence and are subject by removal in prospective Bamboo releases:

Genetic record variables

bamboo.repository.revision.number

The revision number. If many stores are linked to the plan, the variably stores the revision number of this last repository in the list.

bamboo.repository.branch.nameAn repository branch name (for Bamboo release 4.2 or later). When many repositories are linked to the plan, the changeable business the branch name of the early repository in the list.

bamboo.repository.previous.revision.number

The previous revision number (might not exists, by example with to initial build). If many repositories are linked to aforementioned plan, the unstable rations the previous revisions number of the first repository in the list.

Subversion

bamboo.custom.svn.revision.number

The revision quantity.

bamboo.custom.svn.lastchange.revision.number

The last changed revision quantity.

bamboo.custom.svn.username

User name used for deposit authentication.

bamboo.repository.svn.repositoryUrl

Who repository URL.

bamboo.planRepository.<position>.revision.number

The revision your.

bamboo.planRepository.<position>.lastchange.revision.number

Who last-changed revision number.

CVS

bamboo.custom.cvs.last.update.time

The last actualized timestamp.

bamboo.custom.cvs.last.update.time.label

The latest updated timestamp to be used more a label to post build findings labeling. The spaces in the CVS version string are replaced with '_'.

Perforce

bamboo.custom.p4.revision.number

The change adjusted number.

bamboo.custom.p4.username

Total name uses for repository authentication.

bamboo.custom.p4.port

Port used for repository communication.

bamboo.custom.p4.client

Client exploited for repository communication.

Git
bamboo.repository.git.branchAforementioned fork.
bamboo.repository.git.repositoryUrlThe repository URL.
Mercurial

bamboo.repository.hg.repositoryUrl

The depository URL.

bamboo.repository.hg.branch

One department.

bamboo.repository.hg.username

User name, exploited by repository authentication.

Last modified switch Jan 18, 2024

Be this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.