Skip to content

Jenkins and other CI

Jenkins, Buildkite, Tekton, Argo Workflows and laptops use service-account tokens. Create the account, bind it to the repositories it needs and create a token exactly as in GitHub Actions:

Terminal window
E=https://entrepot.example.com
curl -fsS -H "Authorization: Bearer $ADMIN" -X POST $E/api/v1/service-accounts -d '{"name":"jenkins"}'
curl -fsS -H "Authorization: Bearer $ADMIN" -X POST $E/api/v1/role-bindings \
-d '{"role":"developer","subjectType":"user","subject":"sa:jenkins","repositoryPattern":"*-internal"}'
curl -fsS -H "Authorization: Bearer $ADMIN" -X POST $E/api/v1/service-accounts/jenkins/tokens \
-d '{"name":"ci","scopes":["read","write"],"expiresInDays":90}' | jq -r .secret

Store the secret in Jenkins as a Secret text credential (for example entrepot-token) or as Username with password with any username.

Jenkinsfile
pipeline {
agent { docker { image 'node:22' } }
environment {
ENTREPOT_TOKEN = credentials('entrepot-token')
}
stages {
stage('Publish') {
steps {
sh '''
npm config set registry https://entrepot.example.com/repository/npm-internal/
npm config set //entrepot.example.com/repository/npm-internal/:_authToken "$ENTREPOT_TOKEN"
npm ci && npm publish
'''
}
}
}
}

Always pass the token through an environment variable inside single-quoted sh strings, so Groovy doesn’t interpolate it into the build log.

  • One service account per pipeline or team, so the audit log tells you who published what.
  • Restrict tokens with scopes (read for build agents that only install) and expiry (expiresInDays).
  • A scoped credential can’t create a broader token.
  • Tokens are stored as SHA-256 hashes; list and revoke them with GET/DELETE /api/v1/service-accounts/<name>/tokens[/<id>] or in the UI (Administration → Service accounts).