For AI agents: the complete documentation index is available at https://docs.hod.sh/llms.txt, the full documentation bundle is available at https://docs.hod.sh/llms-full.txt, and this page is available as Markdown at https://docs.hod.sh/pipelines/secrets.md.

Secrets and cloud identity

Secrets

secrets: grants secrets by name, on a job (for every step) or on a step. Each grant is a name, or {name, env} to also put the value in a variable.

version: 0
on: [push]
jobs:
  build:
    image: node:22
    steps:
      - run: npm ci && npm run build
        files: [dist/]
  publish:
    needs: [build]
    image: node:22
    secrets: [NPM_TOKEN]
    steps:
      - run: npm publish --ignore-scripts
      - run: ./notify.sh
        secrets:
          - {name: SLACK, env: SLACK_TOKEN}
  • Each granted secret is a file in $HOD_SECRETS, readable only during the step, and with env also a variable, for that step only.
  • Values are replaced by *** in the logs, also when they are base64-, URL- or JSON-encoded. Values must be 8 bytes or more.
  • There is no secrets in CEL: a value can't reach env:, if: or outputs.
  • A step with secrets is never served from the step cache, and cache: on it is an error.
  • On a server, a granted secret that isn't set, whose rule doesn't allow the run, or any secret on a fork's run, fails the job with reason secret before it starts. Storing secrets is in Secrets.

Steps of a job share a container, so the job, not the step, is the boundary: put a step that uses a valuable secret in a job of its own.

Cloud identity

identity: gives a job's steps, or one step, short-lived OIDC tokens signed by the Hod server, which AWS, GCP, Azure and Vault can trust instead of a stored key. identity: {audience: sts.amazonaws.com} makes one token, named token; a list of {name, audience} makes several.

version: 0
on: [push]
jobs:
  deploy:
    image: amazon/aws-cli:2.22.0
    identity: {audience: sts.amazonaws.com}
    env:
      AWS_ROLE_ARN: arn:aws:iam::123456789012:role/deploy
    steps:
      - run: |
          export AWS_WEB_IDENTITY_TOKEN_FILE="$HOD_IDENTITY_TOKEN_FILE"
          aws s3 sync dist/ s3://example-site/
  • Each token is a file in /run/hod/identity/<name>, refreshed while the step runs and masked in the logs. $HOD_IDENTITY_TOKEN_FILE is the first one's path.
  • A step with a token is never cached. Runs from forks get none.
  • What the token's claims are, and how to set up the cloud side, is in OIDC identity.

On your machine

hod local run asks where each secret comes from: --secret NPM_TOKEN=env:NPM_TOKEN, =file:PATH or =cmd:"op read op://ci/npm/token", or a prompt on a terminal. It signs no tokens: say where each one comes from with --identity token=cmd:"vault print token" or =file:PATH.