CI/CD

Bitbucket Pipelines

Use Ennote secrets in Bitbucket Pipelines: store an Ennote token as a secured repository or deployment variable, install the Ennote CLI in the step, and inject secrets with ennote secret get.

How it works

Bitbucket stores one Ennote token as a secured variable, which every step receives as an environment variable. The step installs the Ennote CLI, and ennote secret get <secret> -- <command> runs the 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 Bitbucket

In your repository, open Repository settings → Pipelines → Repository variables, add ENNOTE_TOKEN with the token and select Secured. Add ENNOTE_ORGANIZATION_ID the same way (it does not need to be secured).

To use a different workspace per environment, add ENNOTE_WORKSPACE_ID as a deployment variable instead: Repository settings → Pipelines → Deployments, then set it for Staging and Production separately.

3. Add the pipeline

bitbucket-pipelines.yml
image: node:22

pipelines:
  branches:
    main:
      - step:
          name: Deploy to production
          deployment: production
          script:
            - export ENNOTE_DO_NOT_TRACK=1
            - curl -sSfL https://get.ennote.io/get-cli.sh | sh
            - ennote secret get db-credentials -- npm run migrate
            - ennote secret get aws -- ./deploy.sh

ENNOTE_TOKEN, ENNOTE_ORGANIZATION_ID and ENNOTE_WORKSPACE_ID come from the repository and deployment variables. Replace db-credentials and aws with your secret names.

The node:22 image runs as root and includes curl, so the install script works as is. On Alpine-based images, add apk add --no-cache curl before it.

Several Steps

Each Bitbucket step runs in a fresh container, so install the CLI at the start of every step that runs ennote. To skip the download, build your own CI image with the CLI preinstalled and use it as the image.

FAQ

Are secured variables shown in logs?

Bitbucket masks secured variables in the log, so the token is not shown. Values fetched by ennote secret get are not known to Bitbucket, so don't print them.

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.