CI/CD

Ennote Secrets in CI/CD Pipelines

How to use Ennote secrets in any CI/CD system: store one Ennote token in the CI tool, install the Ennote CLI in the job, and inject secrets into build, test and deploy commands with ennote secret get.

Every CI/CD system works with Ennote the same way. Instead of copying each password and API key into your CI tool's settings, you store one Ennote token there. The job installs the Ennote CLI, which uses the token to fetch secrets and pass them to your command as environment variables:

ennote secret get "db-credentials" -- npm run migrate

Ennote never writes the values to a file or prints them to the build log. When you rotate a secret in Ennote, the next pipeline run uses the new value, with no change in the CI tool.

Guides

CI/CD systemGuide
GitHub ActionsGitHub Actions
GitLab CI/CDGitLab CI/CD
JenkinsJenkins
Azure DevOps PipelinesAzure DevOps
Bitbucket PipelinesBitbucket Pipelines
CircleCICircleCI
TeamCityTeamCity
AWS CodeBuild and CodePipelineAWS CodeBuild
Google Cloud BuildGoogle Cloud Build

Not on the list? The steps below work in any system that can run a shell command.

The Three Steps

Create a token

Create a Personal Access Token with an expiration date and copy it. The pipeline can read every secret the token's owner can read, so use an account with access only to the workspaces the pipeline needs.

Store the token in your CI tool

Save it as a secret or masked variable named ENNOTE_TOKEN. This is the only credential your CI tool holds.

Install the CLI and run your command

Set these environment variables in the job, then install the CLI and run your command through it:

VariableValue
ENNOTE_TOKENThe token, from your CI tool's secret store
ENNOTE_ORGANIZATION_IDYour organization ID
ENNOTE_WORKSPACE_IDThe workspace that holds this pipeline's secrets
ENNOTE_DO_NOT_TRACK1, to turn off telemetry and update checks
curl -sSfL https://get.ennote.io/get-cli.sh | sh
ennote secret get "app" -- ./deploy.sh

With ENNOTE_TOKEN set, the CLI does not need ennote auth login (ennote auth).

Installing the CLI

The install script downloads the latest release from GitHub, checks its SHA-256 checksum and puts the ennote binary in /usr/local/bin. It needs:

  • Linux or macOS. Windows agents are not supported by the script; use a Linux agent, or install the CLI on Windows with Scoop.
  • curl, tar, awk and sha256sum (or shasum). Most CI images have them; on Alpine run apk add --no-cache curl first.
  • Write access to /usr/local/bin: run as root, or as a user with passwordless sudo. Hosted runners on GitHub, Azure DevOps and CircleCI allow this.

On self-hosted agents without root, such as many Jenkins and TeamCity agents, install the CLI once on the agent or bake it into your build image. Download the binary or the .deb, .rpm or .apk package from the releases page. A preinstalled CLI also makes jobs faster and pins the version you run.

Separate Environments

Keep each environment's secrets in its own workspace, for example staging and production, and set ENNOTE_WORKSPACE_ID per job or per CI environment. For the strongest separation, use a different token for production, owned by an account that only has access to the production workspace.

To read one secret from another workspace in a single command, pass --workspace-id (override flags).

Keeping Values Out of Logs

  • Prefer process injection. ennote secret get "<secret>" -- <command> passes values to the command without printing them.
  • Avoid printing single values. ennote secret get "<secret>:<key>" writes the value to stdout. If you must use it, capture it in a variable instead of echoing it, because CI log masking only knows about the CI tool's own secrets, not values fetched from Ennote.
  • Don't enable shell tracing (set -x) in steps that handle secrets.

Rotating the Token

Create a new token, update ENNOTE_TOKEN in your CI tool, run a pipeline to check it, then revoke the old token in Ennote (Personal Access Tokens). Set a reminder before the token's expiration date.

Need Help?

If you encounter any issues or have questions, don't hesitate to contact support. Our team is here to assist you with any challenges you might face.