Repository navigation
🌱 Skip heavy CI jobs on refresh-only pull request heads - #19277
clubanderson wants to merge 2 commits into
Conversation
A hive App base refresh that leaves the PR's three-dot diff unchanged now skips the Docker multi-arch build jobs, the FOSSA scan and the Mutation run when the same workflow already passed on an earlier head and the base delta touches no dependency, Dockerfile, deploy or CI path. Detection runs inside the jobs, so required contexts (gate included) still report. Any doubt runs everything. Fixes #19276 Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. ℹ️ Sentinel: informational, author is trusted (owner), merge is not blocked. Head
No |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether skipping the Docker build, FOSSA and Mutation jobs on a verified base-refresh head (and the new actions: read / job-level permissions in the workflows) is acceptable CI policy.
I read .github/scripts/refresh-only-head.sh, its test, and the workflow edits in docker.yml, fossa.yml and mutation-advisory.yml. I found no defect. Every lookup failure in the script answers false ("run everything"), the steps are continue-on-error, and the gate job still runs, so the required context attaches as before. The body matches the diff.
This PR changes workflow definitions and permissions and decides which checks run on a PR head, which is a trust surface that needs a maintainer rather than a reviewer agent. Facts for the decision:
docker.ymlgatenow has job-levelcontents: readandactions: read, replacing the workflow-level permissions for that job.- The helper is checked out from the PR's own merge ref (
actions/checkoutwith.refresh-check), so a PR that edits the helper controls its own answer. That is no worse than a PR editing the workflow itself, but it means the protection rests on the same-repo and App-signed-merge conditions, not on the script being pinned. - The sensitive-path list covers manifests, Dockerfiles,
src/deploy/and.github/workflows/, so a refresh that pulls in those changes still runs everything.
-- hive: agent=reviewer-2 backend=claude model=claude-sonnet-5-5 claude=2.1.328
|
Needs a decision, not a merge:
Head: verdict requires_human @ec083d1, 80/80 checks green, DCO yes, soak 9m0s of 10m0s. How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
The Docker build jobs now skip a refresh-only head only when every file the base delta brings in is docs or changelog (CHANGELOG.md, changelog.d/, any *.md, docs/, src/docs/); any other file builds the images. FOSSA and Mutation keep the deny list, widened to package*.json, requirements* and Cargo.* anywhere in the tree. Fixture cases cover Makefile, .go, docs-only and nested lock file deltas. Refs #19276 Signed-off-by: Andy Anderson <andy@clubanderson.com>
Fixes #19276
What
Each hive App base refresh reran about 16 workflows (about 38 runner-minutes). This skips the three heaviest jobs on a head whose only change is that refresh:
docker.yml: thegatejob gains a refresh-only check and thebuild,build-contributor,build-hub,build-mxjobs skip when it answers true.gate(required) still runs and succeeds.fossa.yml: the scan, baseline and policy-test steps skip; the job reports success.mutation-advisory.yml: setup, mutation run and comment upsert skip; the previous head's comment stays (same diff).build-and-test, test shards,coverageand every other required context are untouched.The proof (
.github/scripts/refresh-only-head.sh)Workflow form of
HeadIsBaseRefreshOfinsrc/pkg/github/pr_decision_base_refresh.go. True only when all hold:pull_requestsynchronize;hivecommons-hive[bot], committed byweb-flow(or the App), with the previous head as a parent and the merge-base with the base as the other parent;git diff --raw --no-renamesof the head against its base is identical to the previous head's (blobless clone, trees only, about 3s);successon the previous head, or (when that run was cancelled by the refresh) on an earlier head reached through at most 5 hops that each pass 2 and 3;go.mod/go.sum/go.work, other dependency manifest or lock file, Dockerfile,.dockerignore,.fossa.yml,src/deploy/,.github/workflows/,.github/actions/, or the detector itself.Fail safe: any lookup failure or doubt answers false (run everything), and the detector steps are
continue-on-error, so a broken detector can never failgateor skip anything. Each run writesskipped: refresh-only head. ...orrefresh-only check: running everything (<reason>)to the step summary.Checked by hand against live open PRs before pushing: a clean refresh whose previous FOSSA run passed answered true; the same head answered false for docker/mutation (previous runs cancelled, previous head not a refresh); a refresh bringing in
src/Dockerfileanswered false; an unsigned agent-pushed merge answered false; a merge that changed PR files answered false.Protection
The helper lives under
.github/scripts/, outside theTRUSTED_SCRIPTS_TREEpin onsrc/scripts(nosrc/scriptschange, so no re-pin).gate, FOSSA and Mutation addactions: readto list earlier runs;gategets job-levelcontents: read, actions: read(it pushes nothing).Tests and docs
.github/scripts/test-refresh-only-head.sh: local git fixture overfile://plus a stubbedgh; covers the clean refresh, a two-hop walk, and every negative case. Wired intoPR Auto-update Regression Tests.src/docs/ci-refresh-only-heads.md, linked fromdocumentation-map.mdand the final base preparation section ofhive-merge.md.changelog.d/changed-19276-ci-refresh-only-heads.md.