Google Cloud Build
How it works
The Ennote token is kept in Google Secret Manager. cloudbuild.yaml exposes it to a step as ENNOTE_TOKEN with availableSecrets and secretEnv. The step installs the Ennote CLI, and ennote secret get <secret> -- <command> runs your command with the keys of the secret as environment variables. See the CI/CD overview for the common setup.
1. Create a token
Create a Personal Access Token with an expiration, and copy it.
2. Store it in Secret Manager
printf '%s' "<YOUR_ENNOTE_TOKEN>" | gcloud secrets create ennote-ci-token --data-file=-
Or create it in the Cloud Console: Security → Secret Manager → Create secret.
3. Allow Cloud Build to read it
Grant the Secret Manager Secret Accessor role on the secret to the service account your builds run as:
gcloud secrets add-iam-policy-binding ennote-ci-token \
--member="serviceAccount:<BUILD_SERVICE_ACCOUNT_EMAIL>" \
--role="roles/secretmanager.secretAccessor"
4. Add the build config
Each Cloud Build step runs in its own container, and only the /workspace directory is kept between steps. Install the CLI and run your command in the same step:
steps:
- id: migrate-and-deploy
name: node:22
entrypoint: bash
args:
- -c
- |
curl -sSfL https://get.ennote.io/get-cli.sh | sh
ennote secret get db-credentials -- npm run migrate
ennote secret get app -- npm run deploy
env:
- ENNOTE_ORGANIZATION_ID=org_123
- ENNOTE_WORKSPACE_ID=wrk_prod
- ENNOTE_DO_NOT_TRACK=1
secretEnv:
- ENNOTE_TOKEN
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/ennote-ci-token/versions/latest
env: ENNOTE_TOKEN
Replace org_123, wrk_prod, db-credentials and app with your organization ID, workspace ID and secret names. The node:22 image runs as root and includes curl. For deployments with gcloud, use the gcr.io/google.com/cloudsdktool/cloud-sdk image the same way.
$NAME in args with build substitutions. If a command in your script uses a shell variable, write it as $$NAME.Several Steps
To use the CLI in several steps without downloading it each time, install it into /workspace once. That directory is shared between steps:
steps:
- id: install-ennote
name: node:22
entrypoint: bash
args: ['-c', 'curl -sSfL https://get.ennote.io/get-cli.sh | sh && cp /usr/local/bin/ennote /workspace/ennote']
- id: test
name: node:22
entrypoint: bash
args: ['-c', './ennote secret get test-env -- npm test']
env: ['ENNOTE_ORGANIZATION_ID=org_123', 'ENNOTE_WORKSPACE_ID=wrk_ci', 'ENNOTE_DO_NOT_TRACK=1']
secretEnv: ['ENNOTE_TOKEN']
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/ennote-ci-token/versions/latest
env: ENNOTE_TOKEN
FAQ
Is the token shown in build logs?
No. Values from secretEnv are not printed by Cloud Build. Don't echo the token or values fetched by ennote secret get in your scripts.
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.
AWS CodeBuild
Use Ennote secrets in AWS CodeBuild and CodePipeline: keep the Ennote token in AWS Secrets Manager, load it in buildspec.yml, install the Ennote CLI and inject secrets into build and deploy commands with ennote secret get.
Docker
Pass Ennote secrets to Docker containers without .env files: inject them into docker run or docker compose with ennote secret get, or run the Ennote CLI inside the container as the entrypoint.