Documentation · Usage · Reading credentials
CI integrations
A pipeline reads its credentials in one step, with the job's own OIDC token, so nothing secret is stored in the CI system. There is a GitHub Action, a Buildkite plugin and a GitLab template.
| Platform | Integration | Values masked in the log |
|---|---|---|
| GitHub, Forgejo and Gitea Actions | credvane-action | Yes, each line of a multi-line value too |
| Buildkite | credvane-buildkite-plugin | Yes, with the agent's redactor |
| GitLab CI | A template in credvane-cli to include | No: GitLab cannot mask values set while a job runs |
Each one asks the platform for a token with the audience <url>/w/<identity>, reads the specs from the credentials API, and sets an environment variable per spec for the rest of the job. If any read fails, the step fails before any variable is set. The action makes the calls itself and downloads nothing. The Buildkite plugin and the GitLab template install a release of the command line, check its SHA-256, and run it.
The integrations are tested against stand-ins (a fake Credvane, runner and agent), not yet on real GitHub, Forgejo or Gitea runners, Buildkite agents or GitLab runners. See the roadmap.
Before you start
Credvane must trust the job: an identity holding the specs, with a trust policy for the platform's issuer and the pipeline. Note the identity's id, on its page: every integration needs it, or the policy's audience.
| Input | Meaning |
|---|---|
url | Credvane's address |
identity | The identity's id; the token's audience is <url>/w/<identity>. On GitLab the audience goes in id_tokens: instead |
credentials | Spec keys, each optionally spec-key=ENV_NAME. The default name is the key in capitals with - and . as _: deploy-key becomes DEPLOY_KEY |
policy | The trust policy's name, when several match |
audience | Instead of identity, when the policy's audience is something else |
GitLab takes the same inputs as CREDVANE_* variables.
GitHub, Forgejo and Gitea Actions
permissions:
id-token: write # lets the job ask for an OIDC token
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: commitwisedev/credvane-action@v1 # pin a commit SHA in production
with:
url: https://credvane.example.com
identity: 0f3b6c1e-...
credentials: |
deploy-key
npm-token=NPM_TOKEN
- run: ./deploy.sh # sees DEPLOY_KEY and NPM_TOKEN- Forgejo and Gitea: use the full address,
uses: https://github.com/commitwisedev/credvane-action@v1. Forgejo also needsenable-openid-connect: trueon the workflow or job. Gitea's Actions OIDC is not in a Gitea release yet; the same action works once it is. - Pull requests from forks get no OIDC token on any of the three, so the step fails and says so.
- Versions:
v1of the action calls Credvane's API v1, so@v1keeps working. Pin a commit SHA in production and let a dependency bot update it.
Buildkite
steps:
- command: ./deploy.sh # sees DEPLOY_KEY and NPM_TOKEN
plugins:
- commitwisedev/credvane#v1.0.0:
url: https://credvane.example.com
identity: 0f3b6c1e-...
credentials:
- deploy-key
- npm-token=NPM_TOKEN- Needs buildkite-agent 3.70.0 or later. Without its redactor the step fails rather than read a value it cannot hide.
- Write each credential as a string (
npm-token=NPM_TOKEN), not a map entry. - The trust policy must require the pipeline as well as the Buildkite organization: every Buildkite customer shares the same issuer.
- Options pick the CLI release, its expected SHA-256, a mirror, or a CLI already on the agent.
GitLab CI
include:
- remote: https://raw.githubusercontent.com/commitwisedev/credvane-cli/<release>/integrations/gitlab/credvane.gitlab-ci.yml
deploy:
extends: .credvane:read
id_tokens:
CREDVANE_ID_TOKEN:
aud: https://credvane.example.com/w/0f3b6c1e-... # the trust policy's audience
variables:
CREDVANE_URL: https://credvane.example.com
CREDVANE_CREDENTIALS: deploy-key npm-token=NPM_TOKEN
script:
- ./deploy.sh # sees DEPLOY_KEY and NPM_TOKEN- The
aud:must be the policy's audience. A mismatch is the most common failure. - A job with its own
before_scriptreplaces the template's; start yours with- !reference [.credvane:read, before_script]. - GitLab does not mask these values. Do not print them, keep
CI_DEBUG_TRACEoff, and never write them to an artifact or a dotenv report. Where one command needs them,credvane run --oidc gitlab deploy-key -- ./deploy.shkeeps them out of the job's shell.
When something goes wrong
| Message | What to do |
|---|---|
this job has no OIDC token | Add permissions: id-token: write (Forgejo: enable-openid-connect: true). Fork pull requests cannot read |
$CREDVANE_ID_TOKEN is empty | GitLab: add the id_tokens: stanza with the policy's audience |
Credvane did not trust the OIDC token | Check the issuer on Identities → Issuers |
no trust policy lets this token read … | Compare the issuer, audience and claims the message lists with the policy |
several trust policies match this token | Set policy |