Project Variables
Project Variables is an extension of the existing Global and Plan variables. It allows plan administrators to create variables that are available to all plans in the project. The goal is to make variable maintenance easier. In addition, it supports enforcing security where access to global variables is limited to system administrators without adding extra constraints to plan administrators to create their own variables.
Creating a project variable
This example assumes you already have Bamboo setup with the Utility Belt app and have created a Plan.
You can create and use a project variable in three simple steps:
Create a project variable using the Project Configuration screen. Use helloWorldVariable as key and Hello World! as value.
Create a Job with a Script task which has the following inline script body:
echo "${bamboo.helloWorldVariable}"
Run the plan and look at the build log. You will see an echo output of "Hello world!".
Limits to the use of Project Variables
Although there is no limit to the number of project variables, there are still some limitions that you might want to consider: Project variables are only substituted during (remote) task execution. For instance, you cannot use project variables in the repository URL field.
If you do wish to use them in other parts of your configration, please note that Project variables are actually an extension to global variables. If you wish to use the Project variable in the repository URL field, you can do so by using the following notation: ${bamboo.PROJECTKEY.variableName}
.
Replace "PROJECTKEY" with the upper-case value of the project key and "variableName" with the name of the variable you wish to use.