30
Backend
06
Security
12
iOS
21
Infra

Log CI in to Nomad with GitHub OIDC, and run previews in their own Nomad namespace

ADR-0108 ACCEPTED · 2026-11-08
Log CI in to Nomad with GitHub OIDC, and run previews in their own Nomad namespace

Amends ADR-0055: preview jobs run in a Nomad namespace of their own, and the credential that deploys them cannot change production's jobs.

Decision

Store no Nomad credential in GitHub. Nomad trusts GitHub Actions' OIDC provider through a JWT auth method, and each job that talks to Nomad exchanges its OIDC token for a Nomad token that lasts at most an hour. Binding rules match the repository id and the workflow file at master's ref, so a renamed workflow or a copy run from a branch gets no token. Each rule maps to a policy that grants what that workflow does and no more: the preview workflows get write on the preview namespace, and the production deploy may only read and submit jobs in production's namespace.

Run preview jobs and their seed jobs in a separate Nomad namespace. Workload identity policies are scoped per namespace, so a preview job reads only the preview variables and never production's.

Why

CI held one long-lived Nomad token with write on the namespace production runs in, and the preview workflows used it too. A preview deploy credential could therefore stop or replace the production job, and a leaked token stayed valid until someone rotated it by hand. Nomad ACL policies scope by namespace and capability, with no rule per job name, so separating preview and production authority needs a namespace boundary.

The binding to master's copy of a workflow follows ADR-0095: authority comes from what has merged, and no branch can mint a token by editing a workflow.

Rejected alternatives

  • A stored token per workflow, each with a narrow policy. It scopes authority but keeps long-lived secrets in GitHub that need manual rotation.
  • Binding on the workflow's display name. Any workflow can claim a name, so the selector pins the file and ref.
  • Previews in production's namespace with narrower policies. Nomad cannot grant write on some jobs in a namespace and not others.

Consequences

A workflow that needs Nomad must request an OIDC token and appear in a binding rule, so a new one is a policy change. Tools that list or inspect jobs must ask the preview namespace as well, or preview jobs drop out of view. The namespace separates Nomad authority over jobs and variables and nothing else. Previews run on the same cluster as production, so branch code that reaches a preview must be trusted as much as production code.