ci: regenerate generated manifests on Dependabot PRs - #245
Open
rominf wants to merge 1 commit into
Open
Conversation
MANIFEST.md's dependency table and THIRD_PARTY_NOTICES.txt are generated from the dependency graph, and ci.yml gates both against the committed copies. Dependabot cannot run a generator, so every cargo bump it opens fails those two gates on arrival -- 7 of the 10 currently open cargo PRs fail on nothing else. A permanently red dependency queue teaches reviewers to stop reading red, which costs more than the noise. Regenerate both and commit them onto the bump branch. Two jobs, split so that the one compiling the bumped graph (running its build.rs) stays read-only, and the one holding contents: write runs no third-party code and can only write the two generated paths. Commits go through createCommitOnBranch rather than git push: the mutation produces a GitHub-signed commit, which the blocking commit signature gate requires, and expectedHeadOid makes it fail instead of clobber if Dependabot force-pushes mid-run. One manual step remains by design: a GITHUB_TOKEN commit does not start a new workflow run, so a maintainer approves the re-run from the merge box. Removing that needs a GitHub App identity, which is org-level setup rather than a workflow change. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
Collaborator
Author
|
Worth someone triaging separately — |
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.
Summary
MANIFEST.md's dependency table andTHIRD_PARTY_NOTICES.txtare generatedfrom the dependency graph (
cargo xtask manifest/cargo xtask tpn), andci.yml gates both against the committed copies. Dependabot cannot run a
generator, so every cargo bump it opens fails those two gates on arrival.
Right now 7 of the 10 open cargo PRs (#225, #227, #229, #230, #231, #232, #234)
fail on nothing else — they compile and lint clean. A permanently red dependency
queue teaches reviewers to stop reading red, which costs more than the noise
itself.
This adds a workflow that regenerates both files on Dependabot's PRs and commits
them onto the bump branch.
Why it is shaped this way
Two jobs, not one.
generateruns the generators, which means it compilesthe bumped dependency graph — building xtask executes the new versions'
build.rsand proc macros. It iscontents: read.commitholdscontents: write, runs no third-party code, and only unpacks an artifact andcalls the API. This is the split GitHub recommends over
pull_request_target,and it keeps untrusted code and a write token from ever coexisting.
createCommitOnBranch, notgit push. Two properties this repo needs:commits from that mutation are GitHub web-flow signed, so
verify-commits --require-verified(the blockingCommit signatures + sign-offgate) accepts them, where a runner's
git pushwould produce an unsigned commitand fail. And
expectedHeadOidmakes the mutation fail rather than clobber ifDependabot force-pushes the branch mid-run. The DCO half of that gate is covered
by a
Signed-off-bytrailer in the commit body.Writes are bounded to
MANIFEST.mdandTHIRD_PARTY_NOTICES.txt. Theartifact content originates in the untrusted job, so the path allowlist is what
keeps a hostile build script from reaching anything else — at worst it garbles
two files a human still reviews.
One manual step remains, by design
A commit made with
GITHUB_TOKENdoes not start a new workflow run.
So after this commit lands on the branch, a maintainer clicks
"Approve workflows to run" in the merge box to re-run the gates against the
regenerated files. That click is the entire remaining cost, down from
regenerating two files by hand and pushing them.
Removing it needs a non-
GITHUB_TOKENidentity — a GitHub App installationtoken, with credentials stored as Dependabot secrets (Actions secrets are not
available on Dependabot-triggered runs). That is org-level setup rather than a
workflow change, so it is deliberately not in this PR. Happy to follow up if you
want it fully unattended.
Risk
Medium, and worth naming precisely: this grants
contents: writeto a workflowreachable from a Dependabot PR, where today all of CI is read-only. It is
bounded to two generated paths on a
dependabot/*branch, and the job holdingthe token runs no third-party code — but it is a real escalation and should be
read as one, not waved through.
Test plan
Verified locally:
mainand are idempotent — a secondcargo xtask manifest && cargo xtask tpnproduces no diff, and both--checkmodes pass. cargo-about 0.9.1 (the version ci.yml pins) reproducesthe committed notices byte-for-byte.
commitjob's script was extracted from the YAML and executed verbatimagainst the real files: the payload is valid JSON (~888 KB), and both files
base64 round-trip byte-identically. The API validated every field and rejected
only a deliberately-invalid
expectedHeadOid, which is the expectedno-clobber behavior.
verify-commits' sign-off detection accepts the trailer format used here(any line beginning
signed-off-by:, perxtask/src/verify_commits.rs).prek run --all-files --no-group local-toolsandcargo test -p xtask(including the workflow-contract tests) pass.
Not verifiable before merge: the end-to-end path on a real Dependabot PR — the
workflow has to exist on the bump branch to run, which needs this merged and the
branch rebased. The seven manifest-only PRs above are the intended first
exercise, and I will report what actually happens on them, including whether the
approval banner appears as documented.
tests/e2e-cucumber/expectations.tomlxfail rows to narrow.