Use variables in chains

Use variables in chains to tailor how chains behave on each agent or to provide a way of reusing the same value in multiple steps and chains.

Variable types

You can use chain, agent, and global variables in chain steps. PulseUno also provides a set of native built-in variables to include in chains.

The following table describes the variable types in PulseUno.

Type Description
Built-in variables

Native PulseUno variables provide information related to the chain run, for example, the chain number, the changeset ID/commit hash, or the temporary system credentials to authenticate to a vault. For details, see Built-in variables.

The values for built-in variables are derived automatically from the system.

Built-in variables overwrite any other variables that have the same names.

Chain variables

You define chain variables on a chain. When two or more chain steps need the same value, add a chain variable with the necessary value, and reference the variable in multiple chain steps.

If a global or agent variable with the same name exists, PulseUno uses the value of the chain variable.

For details, see Define chain and global variables.

Agent variables

You add agent variables to an agent. They provide information about the agent, for example, the location of a specific compiler. This way, you can reference the compiler location using the variable instead of a fixed value.

When the chain runs on the agent, the variable is replaced with the value defined for the agent.

If the same variable is defined on the associated chain, PulseUno uses the value of the chain variable.

For details, see Add variables to agents.

Global variables

Administrators can define global variables. You can use these variables across multiple chains and chain steps.

If the same variable is defined on the associated agent or chain, PulseUno uses the value of the agent or chain variable. Chain variables override agent or global variables that have the same names.

For details, see Define chain and global variables.

Back to top

Built-in variables

You can use the following native PulseUno variables in chain steps.

Variable Description
changeset_id The alphanumeric changeset identifier (stream version) or commit hash.
suite_name The space in which the chain runs.
product_name The product or Git repository in which the chain runs.
stream_version

Dimensions CM products: The stream version that was delivered.

PulseUno displays the value in the following format:

PRODUCT:STREAM_NAME;VERSION

Git repositories: Has the same value as changeset_id.

stream_name The name of the stream or branch associated with the changeset.
chainnum The build number.
fetch_stream_name The name of the stream or branch checked out in the Fetch Sources step.
fetch_changeset

The alphanumeric identifier of the changeset checked out in the Fetch Sources step.

Has the same value as changeset_id.

PULSE_VAULT_USERNAME

PULSE_VAULT_PASSWORD

Temporary system credentials that represent a one-time username and password to authenticate to a vault when deploying artifacts.

Temporary system credentials are valid only for the duration of the chain run. PulseUno generates the username and password values automatically when a chain is triggered, and invalidates them when the chain finishes.

Note: In script steps, you can use environment variables that are equivalent to built-in variables. For details, see Environment variables.

Back to top

Reference variables in chains

To reference variables in chain steps, use the following syntax: {{variable_name}}

Caution: PulseUno also recognizes the legacy syntax, ${variable_name}. We recommend that you avoid using the legacy syntax for built-in, global, agent, or chain variables, as it's reserved for referencing environment variables in a script.

Example of using an agent variable in a chain:

  1. As an administrator, you create a chain that uses Maven and can run on two agents.

    Maven is installed in different locations on each agent.

  2. You add a variable to each agent, MAVEN_HOME, which defines the location of the Maven installation on that agent.
  3. Then you add the {{MAVEN_HOME}} variable in the chain step.
  4. When the chain runs on an agent, the value of the variable is substituted with the value for the Maven location on that agent.

Back to top

See also: