forked from RoushTech/docker
ci: only rebuild the images a change actually affects #20
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/scope-builds-to-changed-images"
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?
Stacked on #18 (its build.yml changes are the base for these). Retarget to
mainonce that merges.Why
Measured from the job logs rather than guessed:
dotnet-10takes 1191s on native amd64 vs 1288s on arm64 under emulation -- an 8% delta. Inside that step, 1070 MiB installs with multi-hundred-second stalls between individual packages.apk addis the critical path (test run 234:INSTALL_JAVAat 1060s of a 26 min run; the same step took 167s in run 232 -- same inputs, 6x spread, pure mirror variance).Most of that work is for images the commit never touched.
What
changed-targetsworks out what a change affects. The graph is parsed from the Dockerfiles themselves (INCLUDE ./x,FROM ./x#stage,COPY ./fs/y); target names come frombake --printandcompose config. Adding an image needs no edit to it and the mapping cannot drift../testgrowsTEST_SERVICES. It generates atest-subsetaggregator rather than an override file, because compose mergesdepends_onby union and so can only ever add services totest, never narrow it.github.head_refis only set forpull_request, so on a push it fell back to the uniquerun_idandcancel-in-progressnever fired. The weekly run gets its own lane so a Tuesday-morning push cannot cancel the only build covering every image.Measured
fs/dotnet/...PHP.fragment.DockerfileJava.fragment.Dockerfilefs/alpine/...README.mdA 2-service subset ran in 31s vs 6-26 min for the full suite.
Fallbacks bias toward overbuilding: no
BASE_SHA, unreachable commit, empty diff, or a change todocker-bake.hcl/test*.yml/the scripts/.github/all force a full build. In the build job "nothing affected" is an explicitNONEsentinel, so a dropped variable fails loudly instead of silently building nothing.Verification
Passing: closure logic against 8 synthetic diffs and 7 real scoped commits in a throwaway worktree; subset runs; both no-op paths;
act -n; YAML parse.Not verified locally: a green full-suite run. It fails at 27s with
frontend grpc server closed unexpectedlyon thedockerfile-xsyntax frontend. The unmodified script from HEAD fails identically at 26s, so this is a pre-existing local Docker Desktop issue rather than this change -- but the full-suite path rests on inspection plus that comparison, and on CI here.🤖 Generated with Claude Code
0c538a2f7b10f68383f5