This article explains how to add environment variables to a deployment project in Bamboo Server server using the Bamboo Bamboo Command Line Interface app.
Instructions
For this task, use Use the addEnvironmentVariables CLI action addEnvironmentVariables action with deploymentProject and environment as the required parameters.
- addEnvironmentVariables: Add Add deployment environment variables. Use the field parameters field for the variable name and the corresponding value parameters for the variable values.
To add the environmental variables to a project:
- Log in as a Bamboo administrator. Ensure you have the Deployment deployment project with Environment environment defined. T
Navigate to Deploy > All deployment projects to view all deployment projects in the Bamboo instance, navigate to Deploy > All deployment projects.
The below screenshot shows no variables defined.To add the environment variables, execute the below command
Click on Environment (Environment 2 as per the example) → Edit environment.- Select the required Environment and then Edit environment. For this example, Environment 2 > Edit environment is selected as follows:
In this example, no variables are defined as for Environment 2 as shown: Execute the following command to add the environment variables:
Below is theCode Block theme Midnight --action addEnvironmentVariables --deploymentProject DeployProject2 --environment Environment2 --field Inputfield1=InputValue1 --replace
The output on
...
terminal is similar to:
Code Block | ||||
---|---|---|---|---|
| ||||
--action addEnvironmentVariables --deploymentProject DeployProject2 --environment Environment2 --field Inputfield1=InputValue1 --replace
Variable 'Inputfield1' added.
1 variables updated or added to environment. |
...
To verify if variables are added, the output in Bamboo is displayed similar to:
...
Info |
---|
|
...