fix: skip redundant pull_request docker-build run for main/development-head PRs - #1236
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Contributor
✅ Supply Chain Verification Results✅ PASSED 📦 SBOM Summary
🔍 Vulnerability Scan
📎 Artifacts
Generated by Supply Chain Verification workflow • View Details |
6 tasks
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
.github/workflows/docker-build.ymltriggers on bothpull_request(no branch filter) andpush(branches: [main, development]). Whenever a commit lands onmainordevelopmentwhile an open PR's head branch is alsomainordevelopment(bot-generated "propagate main→development" / promotion-style sync PRs), both triggers fire for the identical commit SHA and collide in the sameconcurrency:group, socancel-in-progress: truekills whichever run GitHub treats as older — reported as a misleadingcancelledred X even though nothing actually broke.This PR adds an AND'd job-level skip condition to the
setupjob so thepull_request-triggered instance short-circuits to a cleanskipped(notcancelled) whenevergithub.head_refismainordevelopment— since thepushevent for that identical commit already covers the build independently. Downstream jobs (build-amd64,build-arm64,merge-and-publish,scan-pr-image) all gate onneeds.setup.result == 'success', so the whole graph cascades cleanly toskipped.docs/plans/current_spec.md("Plan: Skip redundantpull_requestdocker-build run for main/development-head PRs") — two rounds of Planning + two rounds of Supervisor review, both approved..github/workflows/docker-build.yml. One functional line (setupjobif:) plus two cross-reference comments (onpush.branchesand thesetupjobif:).Known, intentionally-deferred limitation (§3.4 of the plan)
This fix does not change which of the two triggered runs "wins" GitHub's concurrency-group race —
cancel-in-progress: truecancellation is decided at workflow-run registration time, before any job'sif:is evaluated, so this job-level change cannot influence that decision. Concretely:pull_request'ssetupjob resolves toskippedbeforepushregisters (the commonly observed ordering in this repo), this is a strict improvement:pushfinds nothing meaningful to cancel.pushregisters beforepull_request's job evaluates,pull_requeststill gets cancelled exactly as today — no regression, same as baseline.push's in-progress build gets cancelled by a later-registeringpull_requestrun is neutral under this change — neither created nor improved, since it's decided at registration time, before this fix'sif:logic ever runs.A full fix would disambiguate the
concurrency:group key by event type (e.g. append-${{ github.event_name }}) sopushandpull_requestnever share a group at all — but that's a separately-scoped change needing review of every downstream consumer of the shared group semantics. Tracked as a follow-up: #1235.Validation
actionlint .github/workflows/docker-build.yml— zero findings.lefthook run pre-commit— passes cleanly (actionlint, semgrep, and all other staged-file hooks green).if:line against the plan's §3.2 expression — confirmed identical, parenthesization included.fix/docker-build-skip-pr-push-dedup) is neithermainnordevelopment, so the new skip clause never activates here — this PR itself is the live evidence that normal feature-branch PRs are unaffected. See run results in the PR thread / CI checks below.head=mainagainst a disposable base) was reconsidered during implementation: since this fix isn't merged tomainyet, ahead=mainPR opened right now would exercise the current, unfixedmaincopy ofdocker-build.yml, not this fix — so it wouldn't actually test the new condition. Constructing a branch that both (a) hasgithub.head_refliterally equal tomain/developmentand (b) contains this fix's commit would require pushing to a branch literally namedmainordevelopment, which risks colliding with/mutating the real branches — assessed as not worth the risk for a test. Per the plan's own §7.2 "honest limitation" section, this is falling back to the already-completed Supervisor truth-table verification (all six event-type cases confirmed correct during plan review) plus the exhaustive edge-case table in plan §5. Live confirmation of the skip firing correctly in the wild will happen naturally the next time a real bot-generated main↔development sync PR occurs post-merge — recommend a follow-up check ofgh run list --workflow=docker-build.ymlat that time.Follow-up