CI/CD

Jenkins

Use Ennote secrets in Jenkins pipelines: store an Ennote token as a Secret text credential, bind it with credentials() in a Jenkinsfile, and inject secrets into build and deploy steps with ennote secret get.

How it works

Jenkins stores one Ennote token as a credential. The Jenkinsfile binds it to ENNOTE_TOKEN, and ennote secret get <secret> -- <command> runs each 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 Jenkins

Open Manage Jenkins → Credentials, choose a store and domain (for example System → Global credentials), and click Add Credentials:

  • Kind: Secret text
  • Secret: the token
  • ID: ennote-token

3. Install the CLI on your agents

Jenkins agents usually run as the jenkins user without root, so the install script cannot write to /usr/local/bin. Install the CLI once on each agent, or in the image your agents run, as root:

curl -sSfL https://get.ennote.io/get-cli.sh | sh

You can also install the .deb, .rpm or .apk package from the releases page, for example with your configuration management tool.

4. Add the Jenkinsfile

Jenkinsfile
pipeline {
  agent any

  environment {
    ENNOTE_TOKEN           = credentials('ennote-token')
    ENNOTE_ORGANIZATION_ID = 'org_123'
    ENNOTE_WORKSPACE_ID    = 'wrk_prod'
    ENNOTE_DO_NOT_TRACK    = '1'
  }

  stages {
    stage('Migrate') {
      steps {
        sh 'ennote secret get db-credentials -- npm run migrate'
      }
    }
    stage('Deploy') {
      when { branch 'main' }
      steps {
        sh 'ennote secret get aws -- ./deploy.sh'
      }
    }
  }
}

Replace org_123, wrk_prod, db-credentials and aws with your organization ID, workspace ID and secret names. credentials() makes the token available only during the build and masks it in the console log. when { branch 'main' } works in Multibranch Pipeline jobs; in a regular Pipeline job, remove it.

Docker Agents

If your stages run in a Docker agent, install the CLI in the image you build for CI:

Dockerfile
FROM node:22
RUN curl -sSfL https://get.ennote.io/get-cli.sh | sh
Jenkinsfile
pipeline {
  agent { docker { image 'my-registry/ci-node:22' } }
  // environment and stages as above
}

FAQ

Can I scope the token to one job?

Yes. Store the credential in a folder's credentials store instead of the global one, so only jobs in that folder can use it.

Do I need ennote auth login on the agent?

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.