feat(secrets): rotation scripts open the chore(secrets) PR themselves #151
Loading…
Reference in a new issue
No description provided.
Delete branch "jfraeys/feat/vault-change-pr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After a rotation, the vault change used to need a hand-made
chore(secrets)PR, and the manifest'srotated_atwas updated separately (#143). Now every vault-writing script does both itself.scripts/vault-pr.py --what <label> --key <KEYS> [--restore-local]secrets/vault.sops.ymlplusrotated_at: <today>insecrets/secrets-manifest.ymlfor the rotated keys, on a newchore/rotate-<label>-<timestamp>branch made in a temporary worktree offorigin/main(the operator's checkout is never switched), pushes it and opens the PR withtea. Prints the PR number. Never merges, never reads a value; the commit lists key names only.teais missing, or when commits are SSH-signed and no key is loaded (a commit would otherwise hang silently).--restore-local: after the PR is open, back up the rotated vault (0600,~/.local/state/infra/) and reset the checkout's vault to main's, so a deploy before the merge ships nothing new. Order becomes merge,git pull, deploy; it also removes thegit pullconflict after the merge.Wired in
--restore-localrotate-secret.sh(default on;--no-prskips)regenerate-ci-ephemeral-ssh-key.shrotate-ovh-s3-credentials.shprovision-headscale-api-key.shprovision-ci-state-key.pyEach prints "merge PR #N" when it worked and the old manual instructions when it did not.
Tests:
scripts/tests/test-vault-pr.sh(throwaway bare remote + clone, fake files, faketea): 17 checks covering the happy path, restore + backup, no restore, a failed PR open after the push, main's vault moved, nothing to commit, bad input; added to the lint workflow. test-infra-cli, test-rotation-lock, test-bitwarden-save, test-promotion pass. Not run: a real rotation.scripts/CLAUDE.mdgets the rule for future vault writers.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ