The 1Password Secrets orb for CircleCI is officially supported and maintained by 1Password, but community contributions are welcome.
Requirements
The requirements for getting started with the 1Password for CircleCI orb vary depending on whether you use a service account or Connect server.- Service account
- Connect
Before you use 1Password for CircleCI with a service account, you need to:
- Sign up for 1Password.
- Create a service account.
- Create a CircleCI account.
Get started
- Service account
- Connect
-
Set the service account token environment variable in CircleCI.
On the CircleCI settings page , set the
OP_SERVICE_ACCOUNT_TOKENenvironment variable to token of the service account to use to load secrets. -
Edit the CircleCI configuration file and make the following updates:
-
Update the CircleCI
config.ymlfile to use the 1Password for CircleCI orb. -
Specify the version number or use
volatileto use the latest version number.
onepassword/secretsorb to yourconfig.ymlfile.To use the latest version of 1Password Secrets orb in your project, setconfig.ymlvolatileas the version number.config.yml -
Update the CircleCI
-
Install 1Password CLI version 2.18.0 or later as the first step of a CircleCI job using the
1password/install-clicommand. You must install the CLI in the pipeline for the 1Password CircleCI orb to function. Earlier versions of 1Password CLI don’t support service accounts. Find the latest version number in the 1Password CLI release notes.config.yml -
Use 1Password CLI commands in subsequent steps in the pipeline.
See the following example
config.ymlfiles. Make sure to update2.x.xto 1Password CLI version 2.18.0 or later.- Example 1
- Example 2
config.yml
Reference
The following sections document the 1Password for CircleCI orb commands and the secret reference syntax.Commands
There are three commands to use when you configure your orb:1password/install-cli, 1password/exec, and 1password/export.
Secret reference syntax
You can make secrets available to CircleCI jobs and steps by including references to them in the environment using secret references. Secret reference URIs point to where a secret is saved in your 1Password account using the names (or unique identifiers) of the vault, item, section, and field where the information is stored.Usage examples
Explore the following sections to learn about specific use case examples for the 1Password CircleCI orb.Load secrets with the exec command
To load secrets with the 1password/exec command:
-
Install 1Password CLI with
1password/install-cli. If you’re using a service account, make sure to set the 1Password CLI version to2.18.0or later. -
Use the
1password/execcommand to load secrets on demand and execute commands that require secrets.
1password/exec command as a step in your job, subsequent steps of the job can access secrets.
The following example shows how to use the 1password/exec command to resolve variables at the job level. The exec command automatically masks any secrets or sensitive values that might be accidentally logged.
config.yml
Load secrets with the export command
To load secrets with the 1password/export command:
-
Install 1Password CLI with
1password/install-cli. If you’re using a service account, make sure to set the 1Password CLI version to2.18.0or later. -
Use the
1password/exportcommand to load the secret references exported in the environment. - Access secrets in subsequent steps of the job.
1password/export command to resolve variables at the job level.
config.yml