Define chain and global variables

Add chain and global variables so that you can reference them in chain steps when you need to reuse specific values.

For details about variables and how to reference them in chains, see Use variables in chains.

Add chain variables

Define variables on a chain to reuse the same values in the chain's steps.

Using chain variables, you can include secrets that hold encrypted credentials or other sensitive data. For details about secrets, see Create and use secrets.

To add a variable to a chain:

  1. On the top navigation bar, select a space from the spaces list.
  2. On the Products page, select the product or Git repository where the chain runs.
  3. On the sidebar, select Chains.
  4. In the chain list, click a chain's name to open the chain.
  5. On the chain page, click Edit.
  6. In the chain's editing window, select the Variables tab, and click Add Variable .
  7. Enter a variable name and value pair, for example:

    Name: MAVEN

    Value: M2_HOME

    Note: You cannot add variables with duplicate or empty names.

  8. To specify a secret, enter a variable name and value pair, where the secret is the value defined in the following syntax:

    Secret type Syntax
    Secrets defined in PulseUno

    {{secrets["<secretName>"]}}

    where <secretName> is the name of the secret created in PulseUno.

    HashiCorp Vault secrets

    {{secrets["<secretProvider>:<secretPath>"]/<key>}}

    where:

    • <secretProvider> is the name of the HashiCorp Vault secrets provider, as defined in PulseUno.

    • <secretPath> is the path to the secret in HashiCorp Vault. For example:

      secret/chains/credentials

      When using a K/V version 2 secrets engine, insert the data segment into the path. For example:

      secret/data/chains/credentials

      Tip: To check that the path is correct, run the HashiCorp Vault read command.

    • <key> is the key, or a JSON pointer to the key, whose value you want to access.

  9. (Optional) To make the variable private, select the Private option. The values of private variables are displayed obscured in the user interface.
  10. Click Save.

Back to top

Add global chain variables

Define global variables to reuse the same values across multiple chains and steps.

Note: Administrator permissions required.

To add a global variable:

  1. Navigate to Administration > Global Chain Variables.
  2. On the Global Chain Variables page, click Add variable .
  3. Enter a variable name and value, for example:

    Name: JENKINS_URL

    Value: http://host:8080/jenkins

    You cannot add variables with duplicate or empty names.

  4. (Optional) To make the variable private, select the Private option. The values of private variables are displayed obscured in the user interface.
  5. Click Save.

Back to top

See also: