Ennote Secrets in CI/CD Pipelines
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 system | Guide |
|---|---|
| GitHub Actions | GitHub Actions |
| GitLab CI/CD | GitLab CI/CD |
| Jenkins | Jenkins |
| Azure DevOps Pipelines | Azure DevOps |
| Bitbucket Pipelines | Bitbucket Pipelines |
| CircleCI | CircleCI |
| TeamCity | TeamCity |
| AWS CodeBuild and CodePipeline | AWS CodeBuild |
| Google Cloud Build | Google 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:
| Variable | Value |
|---|---|
ENNOTE_TOKEN | The token, from your CI tool's secret store |
ENNOTE_ORGANIZATION_ID | Your organization ID |
ENNOTE_WORKSPACE_ID | The workspace that holds this pipeline's secrets |
ENNOTE_DO_NOT_TRACK | 1, 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,awkandsha256sum(orshasum). Most CI images have them; on Alpine runapk add --no-cache curlfirst.- Write access to
/usr/local/bin: run as root, or as a user with passwordlesssudo. 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.
Ruby, .NET and Rust
Run Ruby on Rails, ASP.NET Core and Rust apps locally with secrets from Ennote instead of a .env file, by starting them with ennote secret get.
GitHub Actions
Use Ennote secrets in GitHub Actions: install the Ennote CLI on the runner, authenticate with a token stored as a GitHub secret, and inject secrets into a step with ennote secret get, without writing a .env file.