Skip to content

CI: release binaries built with kache and copied into the images; BuildKit's cache in R2 - #169

Merged
ndbroadbent merged 2 commits into
mainfrom
ci/images-prebuilt-bins
Dec 4, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
ci/images-prebuilt-bins

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

images was the long tail on main: up to 12.8 min before a deploy. In run 47251755025 a dependency change made cargo chef cook rebuild every dependency (282 s; cargo-chef caches all of them as one layer), then the app (107 s) and the renderer (104 s). And BuildKit's type=gha cache sits in a GitHub Actions cache that is over its 10 GB limit (10.6 GB, 251 entries), so GitHub evicts entries.

Changes

  • release-bins (new): builds the app's and the renderer's release binaries with kache (manifest key visualci-release, the shared docspring-kache bucket; main writes, PRs read) in rust:1.99.1-trixie. That's the Dockerfiles' own image, so the binaries have the same glibc as the debian:trixie-slim runtime images. It starts with the run, in parallel with the tests. App and renderer are built in separate cargo invocations, as the Dockerfiles build them, so features don't unify.
  • Dockerfiles: a FROM scratch AS bin stage holds the binary the runtime image copies. CI passes --build-context bin=tmp/bin, which replaces that stage, so the Rust stages don't run in docker. A plain docker build still compiles everything as before.
  • BuildKit's cache moves from type=gha to type=s3 in the kache bucket under buildkit/ (ignore-error on writes, so a cache problem never fails a deploy). Read-write key on main (the kache-write environment), read-only on PRs.
  • images runs on pull requests too, building without pushing or logging in, so a change that breaks an image fails its PR instead of main's deploy. The repo is public, so these minutes are free. deploy and site stay main-only.
  • The kache comment records the rule for the shared bucket's write key: only main-branch jobs of DocSpring's own repositories, in a protected environment.

Expected

A dependency change recompiles only the crates that changed, not all of them, and a commit that only touches app code recompiles only the app's crates. Main's deploy no longer waits on cargo inside docker. The numbers from main and PR runs go here once there are a few. This PR's own first run is cold: PRs can't write the cache, and main hasn't built visualci-release yet.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…es; BuildKit's cache in R2; images build on pull requests

release-bins builds the app's and the renderer's release binaries with the compile cache in rust:1.99.1-trixie (the
Dockerfiles' image, so the same glibc as the runtime images), in parallel with the tests. images passes them to
docker build as the named context `bin`, which replaces the Dockerfiles' new `bin` stage, so cargo doesn't run in
docker. A dependency change no longer rebuilds every dependency (cargo-chef's single layer). BuildKit's layer cache
moves from the GitHub Actions cache (over its 10 GB limit) to the kache bucket under buildkit/. Pull requests build
the images without pushing, so a broken image fails there instead of in main's deploy.
@ndbroadbent
ndbroadbent force-pushed the ci/images-prebuilt-bins branch from 2a18d3a to 0dfdf3f Compare December 4, 2026 04:45
@visualci-com

visualci-com Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #381 · 392 unchanged · no changes

This PR vs base: 1 changed since #365, across 3 builds

docspring/visualci · journeys · build #378 · 12 changed, 18 unchanged · approved by visualci coordinator agent (MCP) for Nathan Broadbent

Same version PR #161 approved (build 370) and merged to main; #169 is CI-only and changes no UI.

This PR vs base: nothing since #362, across 3 builds

Snapshot Before After
journeys/personal-and-organization-installations/01-site (changed)
journeys/personal-and-organization-installations/02-own-account-picker (changed)
journeys/personal-and-organization-installations/03-organization-picker (changed)
journeys/personal-and-organization-installations/04-site (changed)
journeys/personal-and-organization-installations/05-not-yours (changed)
journeys/reinstall-keeps-the-organization-and-projects/01-site (changed)
journeys/setup-picks-from-300-repositories/01-site (changed)
journeys/setup-picks-from-300-repositories/03-page-2 (changed)
and 4 more in the build

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent merged commit 1f99b17 into main Dec 4, 2026
16 checks passed
@ndbroadbent
ndbroadbent deleted the ci/images-prebuilt-bins branch December 4, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant