forked from RoushTech/docker
Stop full rebuilds that nothing in the diff justifies #44
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/infallible-pare-cdd36e"
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?
Scoped builds already existed, but two things kept sending runs down the build-everything path far more often than the diff warranted.
Base commit. A branch diffed against the previous push, which is wrong in both directions: a brand new branch has no previous push at all (Forgejo sends an all-zero sha) so its first run rebuilt the world, and on later pushes an image touched by an earlier commit on the branch silently stopped being built and tested. Branches now diff against the merge base with
main, so a run always covers the whole branch.mainkeeps using the previous tip, where that is exactly right.The matrix files.
docker-bake.hcland the three test compose files were inGLOBAL_PATHS, so editing one service's healthcheck rebuilt all ~40 images -- measured over the last 40 commits onmain, the single biggest source of full rebuilds. They are machine readable, so rather than giving up they now get resolved at the base commit and at HEAD and compared target by target; only targets whose resolved definition actually moved get rebuilt.Also narrows
.github/to.github/workflows/build.yml;mirror-baseimages.ymlruns on its own schedule and has no say in this matrix.Effect
Full rebuilds over the last 40 commits on
main: 23 -> 11, and the 11 are genuinely global (the test script, the bake wrapper,changed-targetsitself,build.yml). Costs ~0.2s per run.Verified
test.ymldocker-bake.hclphp-84-healthchecksnodebake targetnode-22 node-24ubuntu-php-84-assertionsmirror-baseimages.ymlNode.Dockerfilenode-22 node-24PHP.fragment.Dockerfile.github/workflows/build.ymldocker-bake.hclEverything fails closed: no base, an unreachable one, or a config file that will not resolve all still mean
ALL. Two traps worth knowing if you touch this:TIMESTAMPdefaults to today's date and is interpolated into every tag, so it is pinned while diffing; and compose reportsbuild.contextas an absolute path that differs between the base checkout and the working tree.Registry-backed layer cache is deliberately left for a separate PR -- different risk profile (credentials, registry storage, cache poisoning).
🤖 Generated with Claude Code