Help Center/ CodeArts Pipeline/ User Guide/ Release Environments/ Configuring an Environment Variable
Updated on 2024-06-27 GMT+08:00

Configuring an Environment Variable

Background

You can use ${variable name} to reference an environment variable when creating or editing a release policy, or use {{variable name}} to reference an environment variable in YAML files. Environment variables include:

  • Custom variables: can be added as needed. Currently, only variables of the string type are supported.
  • Default variables: system parameters, which cannot be deleted or modified. Default variables include ARTIFACT, TIMESTAMP, and PROJECT_ID.

Configuring a Variable

  1. Log in to CodeArts.
  2. Click a project name to access the project.
  3. Choose CICD > Release to access the environment list page.
  4. Click an environment name, the Environment Information tab is displayed. Switch to the Environment Variable tab.
  5. Click Edit Variable to add a variable and set parameters.

    Parameter

    Description

    Variable

    Variable name, which can be customized.

    Type

    Only the string type is supported.

    Value

    The current value of a variable, or empty if you are adding a new variable.

    Change Value

    Set a new variable value here if you are editing a variable.

    Description

    The description of a variable.

    Private Variable

    If a parameter is private, the system encrypts the parameter for storage and decrypts the parameter for usage. Private parameters will not be displayed in run logs.

    Operation

    Click in the Operation column to delete a variable.

    You can also add, modify, and delete variables as required.

  6. After setting all parameters, click Save.
  7. Confirm the information on the dialog box that is displayed, enter the remarks, and click OK.

Historical Version

On the Environment Variable page, you can click Versions to view variable versions.
  • Click a version name to view the variable details.
  • Click in the Operation column to compare the current version with a specified version.

Using a Variable

You can use environment variables in the following scenarios:

  • When creating or editing a release policy, you can use ${variable name} to reference an environment variable in the YAML path, for example, the workload YAML path in the rolling upgrade task.

  • Use {{variable name}} to reference an environment variable in the YAML configuration file associated with the release policy.