A merge publishes the image its PR built, the same digest, instead of building it again (PIPT-56) #212

Merged
merge-queue merged 2 commits from image-reuse into main 2026-11-20 23:00:40 -08:00
Owner

Work package: https://openproject.home.romaine.life/wp/PIPT-56

The web-image and cluster-image paths built the image on the PR for its check and again on the merge (crenellation: 46 s). PIPT-53's reuse convention now covers those images: a merge publishes exactly the image its PR built, the same digest, under the release tag.

What changes:

  • PR: the scope reserves nothing but reads the tag the merge would take (release-version without publishing, as the release suite's scope does) and attests CI_IMAGE_V1 {head, fingerprint} in its own log (cluster-service/prior-image.mjs attest). The fingerprint is the Dockerfile, .dockerignore, what the Dockerfile copies, the build context and image name, the stamped version, and the pipeline-templates files image.mjs runs (followed as prior-build.mjs follows a release build's, without the files that only carry the image).
  • PR: check-image builds with that tag as APP_VERSION (crenellation bakes it into its bundle), runs the self-test, then docker saves the image with its ID into .ci-image/, uploaded as the run's check-image artifact for a week.
  • Merge: image.mjs publish, after release-version reserved the tag, looks through the merged PR's runs of the same suite for one whose scope attested the same fingerprint, whose check-image passed and whose image is still kept; it downloads it, docker loads it, checks the loaded ID is the one the PR recorded, pushes it under the tag, and checks the pushed digest is that ID (the runners' containerd image store makes an image's ID its push digest). No match, or any failure finding or loading it, builds as before.
  • prior-build.mjs exports its PR-run lookup, log attestation (with its marker as a parameter) and script follower (with files to skip), unchanged for releases.

Left alone: a release suite's joined image (spotify-player, tuimail, auth), which keeps its own path. An image whose Dockerfile declares ARG SOURCE_SHA (landing-page) is still built on the merge, since only the merge knows its commit.

Proof (comments below): a real merged PR on crenellation (web-image) and on nelsong6/avatars (cluster-image) through CI_SUITES_REF, where the merge's published digest equals the PR build's and nothing builds on the merge.

Work package: https://openproject.home.romaine.life/wp/PIPT-56 The web-image and cluster-image paths built the image on the PR for its check and again on the merge (crenellation: 46 s). PIPT-53's reuse convention now covers those images: a merge publishes exactly the image its PR built, the same digest, under the release tag. What changes: - PR: the scope reserves nothing but reads the tag the merge would take (`release-version` without publishing, as the release suite's scope does) and attests `CI_IMAGE_V1 {head, fingerprint}` in its own log (`cluster-service/prior-image.mjs attest`). The fingerprint is the Dockerfile, `.dockerignore`, what the Dockerfile copies, the build context and image name, the stamped version, and the pipeline-templates files `image.mjs` runs (followed as `prior-build.mjs` follows a release build's, without the files that only carry the image). - PR: `check-image` builds with that tag as `APP_VERSION` (crenellation bakes it into its bundle), runs the self-test, then `docker save`s the image with its ID into `.ci-image/`, uploaded as the run's `check-image` artifact for a week. - Merge: `image.mjs publish`, after `release-version` reserved the tag, looks through the merged PR's runs of the same suite for one whose scope attested the same fingerprint, whose `check-image` passed and whose image is still kept; it downloads it, `docker load`s it, checks the loaded ID is the one the PR recorded, pushes it under the tag, and checks the pushed digest is that ID (the runners' containerd image store makes an image's ID its push digest). No match, or any failure finding or loading it, builds as before. - `prior-build.mjs` exports its PR-run lookup, log attestation (with its marker as a parameter) and script follower (with files to skip), unchanged for releases. Left alone: a release suite's joined image (spotify-player, tuimail, auth), which keeps its own path. An image whose Dockerfile declares `ARG SOURCE_SHA` (landing-page) is still built on the merge, since only the merge knows its commit. Proof (comments below): a real merged PR on crenellation (web-image) and on nelsong6/avatars (cluster-image) through `CI_SUITES_REF`, where the merge's published digest equals the PR build's and nothing builds on the merge.
A merge publishes the image its PR built, the same digest, instead of building it again (PIPT-56)
Some checks failed
CI / changes (pull_request) Successful in 5s
Fleet / align (pull_request) Successful in 3s
CI / prune-releases (pull_request) Has been skipped
CI / release-version (pull_request) Has been skipped
CI / check-versions (pull_request) Has been skipped
CI / check-fetches (pull_request) Has been skipped
CI / check-image-digests (pull_request) Has been skipped
CI / cached-images (pull_request) Has been skipped
CI / container-health (pull_request) Has been skipped
CI / azure-cli (pull_request) Has been skipped
CI / home-cache-linux (pull_request) Has been skipped
CI / home-cache-windows (pull_request) Has been skipped
CI / cache-save (ubuntu-latest) (pull_request) Has been skipped
CI / cache-save (windows-latest) (pull_request) Has been skipped
Suite default / scope (pull_request) Successful in 10s
Suite default / check-fetches (pull_request) Has been skipped
Suite default / check-rules (pull_request) Has been skipped
CI / actionlint (pull_request) Successful in 13s
Suite default / reused-checks (pull_request) Successful in 18s
CI / service-runtime (one) (pull_request) Successful in 30s
CI / service-runtime (two) (pull_request) Successful in 31s
CI / service-cancellation (pull_request) Successful in 44s
CI / suite-tests-linux (pull_request) Successful in 52s
CI / suite-tests-windows (pull_request) Successful in 58s
CI / setup-linux (nas) (pull_request) Successful in 2m14s
CI / setup-windows (pull_request) Successful in 2m43s
merge-queue conflicts with main
31059d72af
Author
Owner

cluster-image proof, nelsong6/avatars through CI_SUITES_REF=image-reuse (PR, merged):

  • PR run 72: the scope attested CI_IMAGE_V1 for the tag its merge would take (v0.1.7); check-image built sha256:2e8432d69f39e1fcd5cd0a65d36f52b0dd0d75f588c99c54dd68266dd55221fd, ran its self-test and kept it (artifact check-image, 8.5 MB).
  • Merge run 76: reserved v0.1.7, found run 72's attestation and image, loaded it and pushed forgejo.romaine.life/nelsong6/avatars:v0.1.7@sha256:2e8432d69f39e1fcd5cd0a65d36f52b0dd0d75f588c99c54dd68266dd55221fd, the PR build's digest; no docker build ran. The pin PR it opened merged, so main pins that digest. The merge's run took 23 s, against 15 s for the last release that built (a small Go image whose build hits the runner's cache).
cluster-image proof, nelsong6/avatars through `CI_SUITES_REF=image-reuse` ([PR](https://forgejo.romaine.life/nelsong6/avatars/pulls/23), merged): - PR [run 72](https://forgejo.romaine.life/nelsong6/avatars/actions/runs/72): the scope attested `CI_IMAGE_V1` for the tag its merge would take (v0.1.7); `check-image` built `sha256:2e8432d69f39e1fcd5cd0a65d36f52b0dd0d75f588c99c54dd68266dd55221fd`, ran its self-test and kept it (artifact `check-image`, 8.5 MB). - Merge [run 76](https://forgejo.romaine.life/nelsong6/avatars/actions/runs/76): reserved v0.1.7, found run 72's attestation and image, loaded it and pushed `forgejo.romaine.life/nelsong6/avatars:v0.1.7@sha256:2e8432d69f39e1fcd5cd0a65d36f52b0dd0d75f588c99c54dd68266dd55221fd`, the PR build's digest; no `docker build` ran. The pin PR it opened merged, so main pins that digest. The merge's run took 23 s, against 15 s for the last release that built (a small Go image whose build hits the runner's cache).
Author
Owner

web-image proof, romaine-life/crenellation through CI_SUITES_REF=image-reuse (PR, merged):

  • PR run 142: the scope attested CI_IMAGE_V1 for v0.1.10; check-image built with APP_VERSION=v0.1.10 (baked into the bundle) as sha256:18c9c76f712a1f51630100a63bc868927cf721fc1c1eb8713154809069299762 and kept it (80 MB).
  • Merge run 145: reserved v0.1.10, found run 142's image, loaded and pushed romainecr.azurecr.io/crenellation:v0.1.10@sha256:18c9c76f712a1f51630100a63bc868927cf721fc1c1eb8713154809069299762, the PR build's digest; no docker build ran. The whole merge run took 39 s, against 60 s for v0.1.9's, which built.

(The PR's 25-minute check-test ran every package because this branch predates the per-package scoping in #211.)

web-image proof, romaine-life/crenellation through `CI_SUITES_REF=image-reuse` ([PR](https://forgejo.romaine.life/romaine-life/crenellation/pulls/24), merged): - PR [run 142](https://forgejo.romaine.life/romaine-life/crenellation/actions/runs/142): the scope attested `CI_IMAGE_V1` for v0.1.10; `check-image` built with `APP_VERSION=v0.1.10` (baked into the bundle) as `sha256:18c9c76f712a1f51630100a63bc868927cf721fc1c1eb8713154809069299762` and kept it (80 MB). - Merge [run 145](https://forgejo.romaine.life/romaine-life/crenellation/actions/runs/145): reserved v0.1.10, found run 142's image, loaded and pushed `romainecr.azurecr.io/crenellation:v0.1.10@sha256:18c9c76f712a1f51630100a63bc868927cf721fc1c1eb8713154809069299762`, the PR build's digest; no `docker build` ran. The whole merge run took 39 s, against 60 s for v0.1.9's, which built. (The PR's 25-minute check-test ran every package because this branch predates the per-package scoping in #211.)
First-time contributor

merge-queue stopped this at 31059d7: conflicts with main. Push a fix, or once it is fixed outside this pull request, remove and re-add the queue label.

merge-queue stopped this at 31059d7: conflicts with main. Push a fix, or once it is fixed outside this pull request, remove and re-add the `queue` label.
Merge remote-tracking branch 'origin/main' into image-reuse
All checks were successful
Fleet / align (pull_request) Successful in 2s
CI / changes (pull_request) Successful in 3s
CI / prune-releases (pull_request) Has been skipped
CI / release-version (pull_request) Has been skipped
CI / check-versions (pull_request) Has been skipped
CI / check-fetches (pull_request) Has been skipped
CI / check-image-digests (pull_request) Has been skipped
CI / cached-images (pull_request) Has been skipped
CI / container-health (pull_request) Has been skipped
CI / azure-cli (pull_request) Has been skipped
CI / home-cache-linux (pull_request) Has been skipped
CI / home-cache-windows (pull_request) Has been skipped
CI / cache-save (ubuntu-latest) (pull_request) Has been skipped
CI / cache-save (windows-latest) (pull_request) Has been skipped
Suite default / scope (pull_request) Successful in 4s
Suite default / check-fetches (pull_request) Has been skipped
Suite default / check-rules (pull_request) Has been skipped
CI / actionlint (pull_request) Successful in 8s
Suite default / reused-checks (pull_request) Successful in 13s
CI / service-runtime (one) (pull_request) Successful in 17s
CI / service-runtime (two) (pull_request) Successful in 17s
CI / service-cancellation (pull_request) Successful in 22s
CI / suite-tests-linux (pull_request) Successful in 26s
CI / suite-tests-windows (pull_request) Successful in 58s
CI / setup-linux (nas) (pull_request) Successful in 1m12s
CI / setup-windows (pull_request) Successful in 2m7s
merge-queue landed on main
9d02849fbb
# Conflicts:
#	suites/web-app/ci.yml
merge-queue deleted branch image-reuse 2026-11-20 23:00:40 -08:00
Sign in to join this conversation.
No description provided.