Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article explains how to add environment variables to the a deployment project in Bamboo Server server using the the Bamboo Command Line Interface app.

Instructions

For this task, use the Use the addEnvironmentVariables CLI action with deploymentProject and environment CLI actions as  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:

  1. Log in as a Bamboo administratorEnsure you have the deployment project with environment defined.
  2. Navigate to Deploy > All deployment projects to view all deployment projects in the Bamboo instance.
    Image Added

  3. Select the required Environment and then Edit environment. For this example, Environment 2 > Edit environment is selected as follows:
    Image Added
    In this example, no variables are defined as for Environment 2 as shown:
    Image Added

  4. Execute the following command to add the environment variables:

    Code Block
    themeMidnight
    --action addEnvironmentVariables --deploymentProject DeployProject2 --environment Environment2 --field Inputfield1=InputValue1 --replace


The output on terminal is similar to:

Code Block
themeMidnight
titleOutput on terminal
--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:

Image Added

Info
  • It is recommended to test the commands in a non-production environment, or run the action with --simulate parameter to verify the behavior before deploying.
  • Ensure that the Bamboo Command Line Interface app is installed in your Bamboo instance.