fix(ci): Deploy detects changed images from the pushed diff, not head_commit.modified #1126
Reference in New Issue
Block a user
Delete Branch "fix/deploy-detect-changes-by-diff"
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?
Problem
Every image job in
deploy.ymlwas gated oncontains(github.event.head_commit.modified, …). That list describes only the tip commit of a push, and Gitea leaves it empty for merge commits. So every PR landed with a merge commit skipped all six image builds. Thellmimage for #1120 (mergedff1919) was skipped and had to be built and deployed by hand.Fix
dev/scripts/backends/gitea.py::_gen_deploynow emits achangesjob that:github.event.before) into the shallow checkout withgit fetch --depth=1 origin <sha>(verified against this Gitea: a raw-SHA shallow fetch is accepted), andgit diff --name-only, so the whole pushed range counts: a merge commit's branch, or all commits of a direct multi-commit push;path_filterfromstack.toml(globs translated to bashcasepatterns) and publishes one boolean output per image.Each image job
needs: [changes]and gates onneeds.changes.outputs.<image> == 'true'. An image without path filters follows every push. If the previous tip is unknown or unfetchable (first push, history rewrite), every image builds rather than none. Thereportjob also waits onchanges, so a detector failure files an issue like any other job failure.The 11 GB repo rules out
fetch-depth: 0; fetching the single previous tip at depth 1 keeps the job as cheap as the current checkout.Tests
tests/dev/test_gen_config_deploy.py: generated shape (outputs,needs,if,caseglobs, no filter → always), plus the detector script executed for real in a scratch repository: merge-commit push rebuilds the images the branch touched, a multi-commit direct push covers the whole range, unknown/zero/unfetchablebeforebuilds everything.gen_config.py --checkclean;tests/dev+tests/test_notebook_layout.py68 passed.Verification plan
The push of this PR's merge commit to main is itself the first live run of the detector: the
changesjob log lists the diffed files and every image output should befalse(onlydev/,.gitea/andtests/change here).Merged to main as merge commit
d98a47e(local merge + push: the API merge is blocked by the CI/test and Infra CI/mc checks that have been red on main since 2026-09-25). The push ofd98a47eis the first live run of thechangesjob.Pull request closed