Repository navigation
feat(ci): weekly workflow moves the bootstrap's pinned AWS CLI by PR (#1495) - #1501
Merged
Merged
Conversation
scttfrdmn
force-pushed
the
feat/1495-awscli-pin-bump
branch
from
November 2, 2026 19:23
6af65f7 to
c622037
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Fixes #1495
What
A weekly scheduled workflow,
.github/workflows/awscli-pin.yml, moves the AWS CLI v2 pin that the Linux bootstrap installs (awsCLIVersion,awsCLISHA256x86_64andawsCLISHA256aarch64inpkg/launcher/bootstrap.go, from #1490) by opening a PR when a newer release exists. This PR does not move the pin, and the published bootstrap body is unchanged.go run . bootstrap-body | sha256gives63421a2d…3d23both before and after, the v0.155.0 value. The only change tobootstrap.gois in the Go comment above the constants.Design
scripts/bump-awscli-pin.shdoes the work, in this order:scripts/awsclipin/aws-cli-team.ascinto a throwawayGNUPGHOMEand requires exactly one primary key,readonly AWSCLI_KEY_FPR=FB5DB77FD5C118B80511ADA8A6310ACC4672475C. It fails the run while the key is expired or within 60 days of its expiry. This check runs first, so a week with no new release still goes red.2.N.Ntag ofgithub.com/aws/aws-cli, read withgit ls-remote. It needs no token and has no API rate limit, and AWS tags every v2 release there; the public CHANGELOG.rst is built from the same history. The tag is never trusted for the bytes. It only names the version to fetch, and only a version newer than the pin (sort -V) and of the form 2.x is accepted, so it cannot downgrade the pin. If a tag's zip is not uploaded yet (HTTP 403/404), the run logs a::warning::and the next week's run retries..sigfiles and runsgpg --verify. It also requires aVALIDSIGstatus line whose primary-key fingerprint is the pinned one, because a good signature alone is not enough. Then it computes the sha256s.scripts/awsclipin(Go, in the scripts module) rewrites the three constants by name with go/parser. Each must be declared exactly once as a string literal, or the tool fails. It also adds a### Changedentry under## [Unreleased], because the bump changes the published bootstrap body; the entry includes the deploy-the-orchestrator note.permissions: {}at the top level, andcontents: write,pull-requests: writeandissues: writeon its single job. It uses onlyGITHUB_TOKEN. Actions are SHA-pinned (checkout v7.0.1 and setup-go v7.0.0, both already inscripts/action-pins.txt), withcache: falseon setup-go in this write-token job. The workflow does nocurlitself, soTestWorkflowsVerifyWhatTheyDownloaddoes not apply. The script's downloads are verified with gpg rather thansha256sum -c, because a new release's hash cannot be known in advance, and nothing downloaded is ever executed. A rerun skips a branch (bot/awscli-<version>) that already exists.awsCLIVersionset back to 2.39.2, the script picked 2.39.3, verified both signatures and computed exactly the two sha256s bootstrap: INSTANCE_ID is empty on Ubuntu (no ec2-metadata), so every tag read and the --command once-marker use an empty ID #1490 committed by hand. It restoredbootstrap.gobyte for byte, leaving only the CHANGELOG entry. With the real pin it printsAWS CLI pin 2.39.3 is current. A temporaryWARN_DAYS=300gave::error:: ... expires in 241 dayswith rc=1, andnowset past expiry gave... expiredwith rc=1.Refused PRs fall back to an issue
gh api repos/spore-host/spawn/actions/permissions/workflowreturnscan_approve_pull_request_reviews: falsefor both org and repo, so GitHub refuses PR creation byGITHUB_TOKEN.bot/awscli-<version>, the run triesgh pr create. If gh's output is GitHub's refusal (not permitted to create or approve pull requests, matched bygo -C scripts run ./awsclipin pr-refused), the run opens an issue titledAWS CLI pin bump available: <old> → <new>, or updates the open one with that exact title. The issue holds the compare link, the verified version, both sha256s and the signing fingerprint, plus a note that the owner opens the PR from the link.ghfailure fails the run with::error::. So does a failed push (the step'sbash -e) or a signature that does not verify (the bump script).contents: write,pull-requests: writeandissues: write. The workflow-level permissions are still{}.GITHUB_TOKENdoes not trigger CI. Close and reopen it to run the checks.Gates and revert evidence
Every revert below compiled (
go vetwas clean), and the gate failed against it:TestPinConstantsExistInBootstrap,TestBumpCoversEveryAWSCLIPin,TestRewriteChangesOnlyThePins). The tests read the realpkg/launcher/bootstrap.go. The coverage test discovers everyawsCLI*string const in pkg/launcher whose value is a 2.N.N or a sha256, and requires the set to equal what the bump moves.awsCLISHA256aarch64toawsCLISHA256arm64across pkg/launcher: 3 tests fail (no const awsCLISHA256aarch64: the bump would move nothing,const awsCLISHA256arm64 = "f6eb…" looks like an AWS CLI pin the bump does not move).awsCLISHA256riscv64:found 4 AWS CLI pin constants in pkg/launcher, want 3.range order[:0]):after rewrite awsCLIVersion = "2.39.3", want "2.40.1", and the same for both sha256s.TestCommittedKeyIsTheAWSCLITeamKey). The fingerprint is computed in Go (RFC 4880 v4: SHA-1 over 0x99, the length and the key packet), so the test needs no gpg and runs anywhere. The expected value is written out in the test, so changing the constant cannot satisfy it.fingerprint = 2762EB6C9A0AD57A992901654F2DCE5E078DEA6E, want FB5DB77F…. That is also the fingerprint gpg printed for that key, an independent check of the Go implementation.TestBumpScriptPinsTheSameFingerprint). It matches thereadonly AWSCLI_KEY_FPR=assignment, not the bare value.bump-awscli-pin.sh pins FB5DB77ED5…, want FB5D B77F ….TestPRRefusedOnlyForGitHubsRefusal,TestPRRefusedSubcommand,TestFallbackIssueHoldsTheVerifiedPin). GitHub's refusal text falls back. Other errors (a 401,Resource not accessible by integration, no commits, PR already exists, a network error, a different "not permitted to push" message) do not. The issue body must contain the compare link, the version, both sha256s and the fingerprint, and a body with a missing hash, swapped hashes or no compare link is refused.prRefusedreturning true always:prRefused("HTTP 401: …") = true: a real failure would open an issue.TestAWSCLIPinWorkflowRunsTheBumpWithOnlyPRPermissions; it also requiresgh issue create/editto come after the anchoredpr-refusedcheck, whose else-branch mustexit 1), root module, read as YAML with comment lines dropped). It checks that the workflow has a schedule,{}at the top level, exactly one job invoking the script, that job's permissions exactlycontents: writeandpull-requests: write, and nosecrets..run: echo scripts/bump-awscli-pin.sh:0 jobs run scripts/bump-awscli-pin.sh, want 1.actions: write, or droppingissues: write:permissions = …, want exactly map[contents:write issues:write pull-requests:write].exit 1from the non-refusal branch, or replacing thepr-refusedcheck withif false:opens an issue without first checking awsclipin pr-refused and failing otherwise.internal/iamcoverage'sTestEveryMainPackageIsAPrincipalnow listsscripts/awsclipinas a non-principal, because it calls no AWS API.Checks
These pass:
make check, run from /private/tmp.make lint: 0 issues in all 10 modules.semgrep scan --config=auto --error ., with one bare// nosemgrepabove the SHA-1 call. SHA-1 is what defines a v4 PGP fingerprint.actionlint .github/workflows/awscli-pin.yml: clean. Run over all workflows, actionlint reports one SC2001 style note inci.yml:98, which is already there on main.shellcheck scripts/bump-awscli-pin.shscripts/refresh-action-pins.sh --check