Repository navigation
feat: read cache tokens from SSM with the job OIDC token - #4
Merged
Merged
Conversation
nix-setup and nix-cache-push accept an SSM parameter and an IAM role instead of a token: the job exchanges its GitHub OIDC token for the role and reads the token the cache host keeps fresh. The token inputs keep working unchanged.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
rrabenda
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
support/scripts/read-ssm-token.sh ROLE REGION PARAMETER OUT: requests the job's GitHub OIDC token (audience=sts.amazonaws.com),aws sts assume-role-with-web-identity(token from a file),aws ssm get-parameter --with-decryptionwith the temporary credentials in the environment, refuses an empty orCHANGE_MEvalue, masks every secret and writes the value to a 0600 file. Exit 3 = the job has no OIDC token. Nothing secret on argv.nix-setup:cache_pull_token_ssm_parameter,aws_role_arn,aws_region. A read failure warns and builds from source, like a bad token.nix-cache-push:token_ssm_parameter,aws_role_arn,aws_region. A read failure is a failed upload (warning, or error withverify).id-token: write) unless it is a fork's pull request, which keeps today's behaviour (push skipped, pull warns). The existing token inputs are unchanged.docs/using/actions.md: the new inputs and notes.Tests
Step scripts extracted with
yqand run with stubcurl/aws/nix/attic:verified 1 path(s)shellcheckclean (SC2164 on the existingcdexcluded);nix flake checkpass.The whole change (apply in this order)
Why: the CI push token for nix-cache.ygr.ai was a 90-day attic JWT pasted by hand into three repository secrets (genlayer-node, genlayer-consensus, genvm-manager). Nothing rewrote it; it expired about 1 Nov 2026 and every push was refused for a week behind a warning (now made visible by
verify, github-actions#3). This set makes the cache host mint and rotate every CI token into SSM, and CI read its own tokens in-job through a per-repository OIDC role./devexp-dev/nix-cache/ci-tokens/<repo>-{pull,push}for genlayer-node, genlayer-consensus, genvm-manager.github-oidc-<repo>-nix-cache-tokensper repository, reading only its own pair.atticadmand the server key, checks it against the running server, writes it to SSM when the parameter is a placeholder or older than 30 days (tokens valid 90 days). Runs 2 min after deploy/boot, then daily. Also rotates the e2e runner pull tokens, which the runners already read from SSM at job start.nix-setupcache_pull_token_ssm_parameter,nix-cache-pushtoken_ssm_parameter, both withaws_role_arn. The token inputs keep working.After 5: delete the
NIX_CACHE_PULL_TOKEN/NIX_CACHE_PUSH_TOKENrepository secrets. genvm-manager has its role and tokens from 1-3; its workflows still use the secrets (its own wrapper action pins an old commit) and need the same switch by its owners.Note for review: devexp-nix-cache
docs/using/ci.mdrecorded the opposite choice ("no OIDC role per repo just to read a string"). The trade changes because a secret nobody rewrites expires unnoticed; the GitHub-secret path stays supported.