Use a Named Password/Private Key

A named password/private key is a variable that users can use across a project's build job configurations, in any password/private key field in the job configuration, including external Git repositories as well as in SQLcl, PSMcli, and Docker configurations.

When the value of the password or private key changes, you can edit and reset it and the new value will be applied to all jobs and configurations where the variable is used. However, if you change the selection from password to private key (or the other way around), you must you re-enter a new value for the password or private key.

Note that the named password/private key is not an environment variable. To use a named password/private key as an environment variable, create a Password/Private Key build parameter and set it to use the named password/private key.

Create and Manage Named Passwords/Private Keys

If you're a project owner, you can create, edit, and delete named passwords/private keys:

Action How To

Create a named password/private key

  1. In the left navigator, click Project Administration Gear.

  2. Click Builds.

  3. Click the Named Passwords/Private Key tab.

  4. Click + Create Named Password/Private Key.

  5. In Name, enter a name for the variable and then do one of the following:

    • In Password, enter the password.
    • Click the Private Key checkbox, then paste the private key into the Private Key field.
  6. Click Create.

After you create the named password or named private key, share its name with your project users.

Edit a named password/private key

  1. In the left navigator, click Project Administration Gear.

  2. Click Builds.

  3. Click the Named Passwords/Private Key tab.

  4. Click the password/private key name and then click Edit Edit.

  5. Update the password in the Edit Named Password dialog or the private key in theEdit Private Key dialog.

    Note:

    You can't change a named password's name.

  6. Click Update.

Delete a named password/private key

  1. In the left navigator, click Project Administration Gear.

  2. Click Builds.

  3. Click the Named Passwords/Private Key tab

  4. Click the named password/private key name, then click Delete Delete.

  5. In the Delete Named Password or the Delete Private Key dialog, click Delete.

After you delete the named password or private key, let your project users know that it's no longer available.

Configure a Job to Use a Named Password/Private Key

Here's how you can configure a job that uses a named password/private key:

  1. Open the job’s configuration page.
  2. Click the Parameters tab.
  3. Click Add Parameter and select Password/Private Key Parameter.
  4. In the Name field, enter a name for the parameter, then do one of the following:
    1. If you're defining a password, in the Default Value field, enter the Named Password/Private Key, if previously defined, in the format #{password_name}.
    2. If you are defining a private key, select the Private Key checkbox and either enter the Named Password/Private Key, if previously defined, in the format #{pkey_name} or paste the private key directly into the Private Key field, for example:
      -----BEGIN RSA PRIVATE KEY-----
      MIIEogIBAAKCAQEAzr32xevtOevm1ZKQ3alPWK888...
      -----END RSA PRIVATE KEY----
      

      When the named variable for the private key was created, it must have been set as a private key, not a password. The named variable for the private key will then be displayed as *****.

  5. Click Save.