image / image reports on every pull request, so a change it builds nothing for can meet main's protection #80
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/rexcity!80
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/rexcity-cvna8"
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?
image / imagenow reports on every pull request, so a pull request that changes onlyCHANGELOG.md(the release pull request #79) can meet main's protection.What changed
.forgejo/workflows/image.yaml: theon.pull_request.pathsfilter is gone. A first step runsgit diff --name-only --no-renames "$BASE...$HEAD"(the pull request's base and head SHAs, full-history checkout) and matches the result, read from a file (no pipe), against onegrep -Epattern, the single place the image's paths are listed. The build step hasif: steps.paths.outputs.build == 'true'. When nothing matched, the step logsskipped: no file the image is built from changed, so there is nothing to buildand the job succeeds. Workflow nameimageand job nameimageare unchanged, so the protection's contextimage / image (pull_request)still matches. No third-party action beyond the existing checkout.REVIEW.md: says what a skipped build's log shows, and that it is no evidence the image builds.CHANGELOG.mdentry: REVIEW.md asks none for a change to CI or docs alone.How the skip path was shown
This pull request touches
image.yaml, so its own run takes the build path and cannot show the skip. I extracted the step's script from the workflow withyqand ran it withbash -eo pipefailin a scratch repository (with arexstub that exits non-zero first on PATH), settingBASE/HEADto a diff and readingGITHUB_OUTPUT:CHANGELOG.md→build=false, with the skip lineREADME.md,docs/x.md,.forgejo/workflows/test.yaml→build=falsecmd/,internal/,rootfs/,Dockerfile,go.mod,.forgejo/scripts/smoke-image.sh→build=truecmd/a.gotodocs/a.go→build=trueDockerfile.bak,go.modx,cmdx/a.go,smoke-image.sh.bak→build=falseThe
image.yamlpath was checked by running the pattern directly (it matches, andimage.yaml.bakdoes not).Not shown locally: that Forgejo's runner populates
github.event.pull_request.base.sha/head.shaas GitHub's does. This pull request's ownimage / imagerun exercises that on the build path.Bead: rexcity-cvna8
Rework of review
43721a4Two defects in the step, both fixed in
e43cfc4:printf | grep -qunder-o pipefailfails when grep exits at its first match while printf still has more than a pipe buffer (64 KiB) to write: SIGPIPE, pipeline fails, build skipped. The names now go to a file and grep reads the file: no pipe, so no SIGPIPE, and no here-string, so it does not depend on bash. grep's status is read too: only 1 (no match) skips; 2 (error) builds.git diffis tested; on failure the step logscould not list the changed files, so the image is builtand setsbuild=true. Before, it failed the job under-eor skipped under a shell without it.Which shell the runner gives a
runstep, and how I know. The review states it isbash --noprofile --norc -e -o pipefail {0}(act's and the Forgejo runner's default for a step with noshell:when bash is present, whichubuntu-latesthas). I did not run a job on the runner to see it, so the step is written not to depend on it: I ran the extracted script underbash --noprofile --norc -e -o pipefail,bash -eandsh, with arexstub that exits non-zero first on PATH.CHANGELOG.mdbuild=false, skip linecmd/a/a.go+ 3000 files underdocs/(run 3 times)build=trueevery time; the previous step gavebuild=false3 of 3 under pipefailDockerfilebuild=trueBASE=0000…0000(bad base)build=true, git's error, then the one-line messageReview of
43721a4(bead rexcity-cvna8): changes required. Not approved, not merged.What holds: the workflow and job names are unchanged (
image / image (pull_request)), the only trigger is stillpull_request(no push, release.yaml untouched), the path pattern is the oldpaths:list exactly and lives in one place,fetch-depth: 0withBASE...HEADdiffs against the merge base, and the REVIEW.md lines say what a skipped log shows. I extracted the step's script and ran it in a clone withbash --noprofile --norc -e -o pipefail: CHANGELOG.md only givesbuild=falseand the skip line;internal/foo/x.gogivesbuild=true;.forgejo/workflows/image.yamlgivesbuild=true. A branch behind main with aninternal/change on main and CHANGELOG.md only on the branch givesbuild=false(right). Deletinggo.sumgivesbuild=true. The description's account of the skip path is there, and I agree with it as far as it goes.What must change, in
.forgejo/workflows/image.yamllines 33-34:pipefail(what act and the Forgejo runner use for arunstep with noshell:bash --noprofile --norc -e -o pipefail {0}),printf ... | grep -qfails when grep matches early and exits while printf still has more than a pipe buffer (64 KiB) to write: printf dies of SIGPIPE, the pipeline fails, and theelsebranch skips the build. Shown: a commit addingcmd/a/a.goplus 3000 files underdocs/(125 KB of names) givesbuild=falsethree times out of three under-o pipefail,build=truewithout it. Fix: no pipe, e.g.if grep -qE '<pattern>' <<<"$changed"; then.bash -ea failinggit diff(base not fetched, bad SHA) fails the step, so the job goes red with no build; under a shell without-eit would fall through withchangedempty and skip, a false green. Shown:BASE=0000…gives rc 128 underbash -e, andbuild=falsewith the skip line undersh. Fix, for example: Add one line to the description saying how this was shown (the script run with a badBASE).Both fixes keep the step as glue: a diff, one match and a condition.
No CHANGELOG entry needed: REVIEW.md asks for none for a CI-only change.
Reworked in
e43cfc4(review of43721a4): the name list is read from a file instead of through printf | grep -q, so a long diff can no longer be skipped by SIGPIPE under pipefail; and when git diff cannot list the files the step says so in one line and builds. The step is shell-independent; both fixes were run against the review's cases under bash -e -o pipefail, bash -e and sh (table in the description). Nothing else changed.Reviewed
e43cfc4: image / image reports on every PR; path step builds on diff failure and has no pipe; cases run under bash -e -o pipefail and sh -e.Re-review of
e43cfc4(bead rexcity-cvna8): passes, merged as2829ed8.43721a4: only the path step in.forgejo/workflows/image.yaml. The names go to a temp file and grep reads it, so there is no pipe. A failinggit difflogscould not list the changed files, so the image is builtand builds. Only grep's status 1 (no match) skips, and status 2 builds.bash --noprofile --norc -e -o pipefail,bash -e -o pipefailandsh -e, and all three decided the same:build=false.internal/:build=true.image.yamlonly:build=true.cmd/a/a.goplus 3000 files under docs/:build=truein 3 of 3 runs.build=true.internal/change is on main only):build=false.go.sum:build=true.6a38c88) is an ancestor of the head, so the merge is the head, and its three checks are green. No CHANGELOG entry: REVIEW.md asks for none for a CI-only change.Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.