test: authenticate the caproni e2e suite with a token-exchange JWT
Summary
The test/caproni e2e rig and its suite (scripts/e2e/run-e2e-tests.sh) ran on
the bootstrap-token stub. This switches them to token_exchange so the suite
exercises the JWT authentication path instead.
test/caproni/values/artifact-registry.yaml— replace theauth.bootstrap_tokenblock withauth.token_exchange, verifying against the self-signediam-data-accessrig's committed JWKS (scripts/iam-rig-mint-jwt/testdata/jwks.json). No monolith or IAM service in the cluster is required; the pod only needs egress to fetch the JWKS.keys_urlis pinned tomain(a stable committed fixture), mirroring the raw-JWKS URL thetest:integration:iam-rigjob already uses.scripts/e2e/run-e2e-tests.sh— mint a short-lived rig JWT per run withiam-rig-mint-jwt(issuer and audience matching the config,origin_idset to the provisioned namespace's entity, and the non-emptylocal_idclaim thatuserauthrequires) instead of sending the dev bootstrap token.AR_TOKENstill overrides, for a rig on a different issuer.docs/dev/caproni-e2e.md— describe the new auth path.
Behavior-preserving for the suite's assertions; only the credential and the AR auth mode change. ~58 lines across 3 files.
Governing ADRs
ADR-020 (Authentication flow) — token-exchange local JWT validation. This change conforms: it moves the e2e rig onto the token-exchange validator using the interim self-signed issuer ADR-020 describes, rather than the bootstrap stub. No deviation; no product code changes.
Testing
Deployed the test/caproni rig locally (published v1.373.0 chart + these
values) and ran the suite end to end:
- The deployed AR logged
token-exchange: JWKS fetched; verifier readyfrom the committedkeys_url, and gated readiness on it. run-e2e-tests.shminted a rig JWT and passed all 8 scenarios (provision 201, idempotent replay 200, resolve 200, create repo 201, read 200, list 200, recreate conflict 409). The JWT authenticated on both the/api/gitlab/v1platform surface (validator fallback) and the/api/v1management surface.
Supporting local checks:
- The minted token verifies through AR's real
tokenexchange.Validatoragainst the committed JWKS with the config's issuer/audience. - The pod's
appConfig.dataloads throughconfig.Loadwithtoken_exchangeselected andbootstrap_tokenabsent. go test ./internal/auth/... ./internal/config/... ./scripts/iam-rig-mint-jwt/...and the composed-app token-exchange test pass;shellcheckclean.
The CI test:e2e:caproni job (k3d in dind) and the -tags=integration suite
(testcontainers) run in CI.