Environment Variables Configuration

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

Besides the key-value syntax, the following properties can also be used under an environment variable definition to enhance its configuration. The following properties are available for environment variables declared in both pipelines and steps configurationsections.

Important

Environment variable names set at pipeline-level must be unique. A step cannot include the same environment variable name as the one set at the pipeline-level.

Property

Description

Required/Optional

default

Default value for the environment variable.

Required

description

Describes the environment variable usage. This description is displayed in the custom run configuration panel.

Optional

values

List of values that can be assigned to environment variables when custom run configuration is used in the UI.

Optional

allowCustom

Determines if users are allowed to use a custom value that is not part of the list of values. Default value is false.

Optional

allowMultipleValues

Determines if users are allowed to use multiple values for an environment variable in a custom run. Default value is false.

Optional

defaultMultipleValues

Applicable when allowMultipleValues is set as true. Set the default value from the list of values set for allowMultipleValues.

Optional

secure

Secure environment variables are encrypted variables that can be used in your pipelines without exposing their value. These environment variables are ideal for private information, such as passwords.

When set as true, the value provided is masked in the Pipelines UI. In your pipeline, if you echo, or print a secret environment variable, it is substituted with XXXXX. Default value is false.

As shown in the example below, the secure property requires a default value.

Example

steps:
  - name: dependency_version_check
    type: Bash
    configuration:
      environmentVariables:
        mySecureEnv:
          allowCustom: true
          secure: true
          default: "someValue"

Optional

Example - Custom Values

pipelines:
  - name: my_pipeline
    configuration:
      environmentVariables:
        readOnly:
          env1: pipe_value1
          env2:
            default: pipe_value2
            description: This is env2 description
            values:
              - pipe_value2
              - pipe_value3
              - pipe_value4
    steps:
      - name: my_step
        type: Bash
        configuration:
          environmentVariables:
            step_env1:
              default: step_value1
              description: This is step_env1 description
              values:
                - step_value1
                - step_value2
                - step_value3
              allowCustom: true
            step_env2: step_value5
            step_env3:
              allowCustom: true
              secure: true
              default: "someValue"
        execution:
          onExecute:
            - echo "test"

When you trigger a run with custom configuration, the UI uses the configurations in the YAML file to control user input in the Run With Custom Configuration panel:

envVariable_12may23.png

In the YAML, if allowCustomis set as true, you can enter any value for that field to define your own value for the run. In the example above, you can enter a custom value forstep_env2, in addition to the values that are already defined. Note that the custom value is available for a specific run only.

allowCustom_27jun22.gif
Example - Multiple Values
pipelines:
  - name: single_test
    configuration:
      environmentVariables:
        readOnly:
          env: 
            default: "singletest"
            values: ["singletest", "testing"]
            allowCustom: false
          env2: "test_p2"
          env3:
            defaultMultipleValues: ["random_1"]
            description: "testing"
            values: ["random_1", "random_2", "random_3", "random_4"]
            allowCustom: false
            allowMultipleValues: true
    steps:
      - name: trigger_2
        type: Bash
        execution:
          onExecute:
            - printenv
            - echo ${#env3[@]}
            - echo ${env3[0]}
multipleValues_05oct23.png