Guides

GitLab CI/CD

Use Ennote secrets in GitLab CI/CD: store an Ennote token as a masked CI/CD variable, install the Ennote CLI in the job, and inject secrets into scripts with ennote secret get.

How it works

The job installs the Ennote CLI, which reads ENNOTE_TOKEN, ENNOTE_ORGANIZATION_ID and ENNOTE_WORKSPACE_ID from the environment. ennote secret get <secret> -- <command> runs the command with each key of the secret as an environment variable, without writing a file.

1. Create a token

Create a Personal Access Token with an expiration, and copy it.

2. Store it in GitLab

In your project, open Settings → CI/CD → Variables → Add variable, set the key to ENNOTE_TOKEN, paste the token, and select Mask variable (and Protect variable if only protected branches deploy).

3. Add the job

.gitlab-ci.yml
deploy:
  stage: deploy
  image: alpine:3.20
  variables:
    ENNOTE_ORGANIZATION_ID: org_123
    ENNOTE_WORKSPACE_ID: wrk_prod
    ENNOTE_DO_NOT_TRACK: "1"
  before_script:
    - apk add --no-cache curl
    - curl -sSfL https://get.ennote.io/get-cli.sh | sh
  script:
    - ennote secret get aws -- ./deploy.sh
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

ENNOTE_TOKEN comes from the CI/CD variable. Replace the IDs and the secret name with yours. On images other than Alpine, install curl with that image's package manager.

FAQ

Can different environments use different workspaces?

Yes. Set ENNOTE_WORKSPACE_ID per job or per GitLab environment, or pass --workspace-id to a single command (ennote secret get).

Do I need ennote auth login?

No. With ENNOTE_TOKEN set, the CLI authenticates headlessly (ennote auth).

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.