Managing Environment Variables

Use these tutorials to create, edit, and delete global, project, pipeline, and app environment variables.

Creating Environment Variables

You can create environment variables at the platform badge envvar global, project badge envvar project, pipeline badge envvar pipeline, and app badge envvar app level. This allows you to create values dedicated to a specific scope without impacting other projects and pipelines.

You can create up to 200 environment variables per platform, project, pipeline, and app. When you reach this limit, the create button becomes unavailable, preventing you from creating new environment variables.
  1. Choose whether you want to create a global, project, pipeline, or app environment variable:

    • Global Environment Variables

    • Project Environment Variables

    • Pipeline Environment Variables

    • App Environment Variables

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    3. Click The "Pipelines" page icon is represented by several connected jobs. Pipelines from the secondary navigation menu to open the project’s pipeline library.

    4. Click a pipeline in the list to open it and access its details.
      The pipeline The "Overview" page icon is a square divided into several other squares. Overview page opens.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    3. Click The Apps page icon is a PC screen with a star in the middle. Apps from the secondary navigation menu to open the project’s app library.

    4. Click an app in the list to open it and access its details.
      The app The "Overview" page icon is a square divided into several other squares. Overview page opens.

  2. Click settings env vars a Environment variables from the secondary navigation menu.
    The page opens with the list of existing environment variables.

  3. Click Create variable to create a new environment variable.
    A panel opens that you can edit.

  4. Enter the required information.

    • Environment variable names is mandatory. It has to start with a letter and can be up to 128 characters, including alphanumeric characters (a-z) (A-Z) (0-9) and underscores (_).

    • The environment variable value can be up to 2,048 characters.

    • The description is optional and have no restrictions, but it is a good practice to add it and keep it short and informative.

    • You can select the option is password if your value is a password and must be hidden.

    Existing environment variables that do not follow these rules are flagged as errors.

  5. Click Save to confirm the creation.

The created environment variable appears in the list of the corresponding scope, that is, either in the global, project, pipeline, or app settings env vars a Environment variables page.

Deleting an Environment Variable

  1. Click the environment variable you want to delete.

    You must be on the settings env vars a Environment variables page of the specific level you want to delete. In other words, you cannot delete a pipeline environment variable from the project settings env vars a Environment variables page. To delete a pipeline environment variable, you must be on the settings env vars a Environment variables page of the desired pipeline. To delete an app environment variable, you must be on the settings env vars a Environment variables page of the desired app, and so on.
  2. In the right-hand panel that opens, click delete Delete.
    A confirmation message appears.

  3. Click Delete again to confirm the deletion.
    Be careful, there is no progress bar to cancel the deletion once it is confirmed. Besides, deleting variables used by jobs or custom apps can cause them problems.

Editing Environment Variables

  1. Choose whether you want to create a global, project, pipeline, or app environment variable:

    • Global Environment Variables

    • Project Environment Variables

    • Pipeline Environment Variables

    • App Environment Variables

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    3. Click The "Pipelines" page icon is represented by several connected jobs. Pipelines from the secondary navigation menu to open the project’s pipeline library.

    4. Click a pipeline in the list to open it and access its details.
      The pipeline The "Overview" page icon is a square divided into several other squares. Overview page opens.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    3. Click The Apps page icon is a PC screen with a star in the middle. Apps from the secondary navigation menu to open the project’s app library.

    4. Click an app in the list to open it and access its details.
      The app The "Overview" page icon is a square divided into several other squares. Overview page opens.

  2. Click settings env vars a Environment variables from the secondary navigation menu.
    The page opens with the list of existing environment variables.

  3. Click the variable you want to change in the list.
    A panel opens that you can edit.

  4. Change the information as needed.

    • Environment variable names is mandatory. It has to start with a letter and can be up to 128 characters, including alphanumeric characters (a-z) (A-Z) (0-9) and underscores (_).

    • The environment variable value can be up to 2,048 characters.

    • The description is optional and have no restrictions, but it is a good practice to add it and keep it short and informative.

    • You can select the option is password if your value is a password and must be hidden.

    Existing environment variables that do not follow these rules are flagged as errors.

  5. Click Save to save your changes.

Overriding Environment Variables

Environment variables are unique within a scope, but an inferior level can override a higher level. In other words:

  • A project environment variable can override a global environment variable.

  • A pipeline environment variable can override project and global environment variables.

  • An app environment variable can override project and global environment variables.

It works the same way in all cases.

  1. Navigate to:

    • Project Environment Variables

    • Pipeline Environment Variables

    • App Environment Variables

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    3. Click The "Pipelines" page icon is represented by several connected jobs. Pipelines from the secondary navigation menu to open the project’s pipeline library.

    4. Click a pipeline in the list to open it and access its details.
      The pipeline The "Overview" page icon is a square divided into several other squares. Overview page opens.

    1. Click The "Projects" module icon is a folder. Projects from the primary navigation menu.
      By default, the The "All Projects" page icon is a folder and the same as the "Projects" module. All Projects page opens with the list of existing projects.

    2. Click a project in the list to open it.
      By default, the The "Jobs" page icon is a 3D pyramid of three squares. Jobs page opens with the list of existing jobs.

    3. Click The Apps page icon is a PC screen with a star in the middle. Apps from the secondary navigation menu to open the project’s app library.

    4. Click an app in the list to open it and access its details.
      The app The "Overview" page icon is a square divided into several other squares. Overview page opens.

  2. Click settings env vars a Environment variables from the secondary navigation menu.
    The page opens with the list of existing environment variables.

  3. Click the variable you want to override in the list.
    A panel opens that you can edit.

  4. At the bottom of the panel, click Override in this project/pipeline/app.

  5. Enter the required information for the corresponding scope.

  6. Click Save to save your changes.

The overridden environment variable still exists at the top level and is still applied, except in the current project, pipeline, or app, where it will be applied with the new value.

Creating and Modifying Variables in a Job Output in a Pipeline

In a pipeline execution context, you can create and modify variables at the output of a job to transfer and use them in the next job.

  1. Enable the settings env vars Variables setting in your pipeline from the pipeline The "Overview" page icon is a square divided into several other squares. Overview page or from its edit Edit mode.

    1. Click settings env vars Variables.
      A panel opens with the existing variables in a code block.

    2. Click the switch to enable the modification of variables in pipeline execution.

  2. To use variables in the code of your jobs, you must write in text form the variables you want to use in other jobs in the output-vars.properties file.

    1. Create the output-vars.properties execution variables output file in the /workdir folder that is located in the local file system of your job.

    2. Write your variables in text form in this file.

      You can either write:

      • One variable per line with the following patterns: <VARIABLE_NAME>=<variable_value>.

      • Several variables on one line, separated by the special character \n: <VARIABLE_NAME>=<variable_value>\n<VARIABLE_NAME>=<variable_value>\n<VARIABLE_NAME>=<variable_value>.

      Variable names is mandatory. It has to start with a letter and can be up to 128 characters, including alphanumeric characters (a-z) (A-Z) (0-9) and underscores (_).

      Example 1. Defining variables for a Bash job

      To define the following variables in a Bash job:

      <VARIABLE_NAME> <variable_value>

      myVariable_1

      Hello everybody

      myVariable_2

      2023

      Other_variable

      444

      Write the following code line in the command line of your job:

      echo -ne 'myVariable_1=Hello everybody\nMyVariable_2=2023\nOther_variable="444"' > /workdir/output-vars.properties
      Refer to the documentation of the technology used in your job to know how to write to a file.
      Example 2. How to read variables?

      To read variables in your job’s code, you can use:

      • <VARIABLE_NAME>: Corresponds to the last value written by the previous job, which is read when the current job starts.

      • <INIT_VARIABLE_NAME>: Corresponds to the pipeline initialization value, that is, the value of the corresponding environment variable readable by the pipeline.

      • <jobAlias_VARIABLE_NAME>: Corresponds to the output value written by the job referenced by the alias.

      For example, to read the variables of the previous example, write the following code line in the command line of your job:

      echo $myVariable_1
      echo $INIT_myVariable_1
      echo $jobAlias_myVariable_1
      echo $myVariable_2
      echo $INIT_myVariable_2
      echo $jobAlias_myVariable_2
      echo $Other_variable
      echo $INIT_Other_variable
      echo $jobAlias_Other_variable

      The output variables will be retrieved in the next jobs during pipeline execution and used as environment variables.

You can view a summary table of the variables used and modified for each job during the pipeline execution. In the The "Overview" page icon is a square divided into several other squares. Overview and The "Instances" page icon is three overlapping squares. Instances pages of the corresponding pipeline, click See Variables from the context menu of the job instance.