Skip to content

feat(ci): cache the docs image build through ghcr.io - #316

Merged
Minipada merged 2 commits into
jazzyfrom
feature/315-podman-build-cache
Aug 10, 2026
Merged

feat(ci): cache the docs image build through ghcr.io#316
Minipada merged 2 commits into
jazzyfrom
feature/315-podman-build-cache

Conversation

@Minipada

Copy link
Copy Markdown
Owner

Summary

  • tools/ci/pre-commit/build_doc.sh never wired up a registry build cache — unlike tools/e2e/scripts/build.sh, which already accepts CACHE_REF and passes --cache-from/--cache-to to podman build. Every GitHub Actions run is a fresh VM, so podman's local build cache never survives between runs; doc.yaml's image (a Rust toolchain + five cargo installs) was rebuilding from scratch on every single run.
  • Added the same CACHE_REF mechanism to build_doc.sh, mirroring build.sh's pattern.
  • Wired doc.yaml to log into ghcr.io, compute a stable dc-doc-cache ref, and pass it through — mirroring ci.yaml's build-workspace job (including the lowercasing dance, since ghcr image names must be lowercase).
  • packages: write was added to doc.yaml's permissions, but note: GitHub forces GITHUB_TOKEN to read-only on pull_request from a fork regardless of what's requested — documented inline. A fork PR just builds cold, same as before this change; the build does not fail.

Deliberately out of scope

ci.yaml's build-e2e-image job also runs a bare podman build (tools/e2e/Containerfile.e2e) with no cache flags. Its FROM is the just-built, SHA-tagged workspace image — a different ref every run — so a cache keyed on the prior layer's digest can never hit there. The layer itself is also just 3 COPYs + a chmod (sub-second). Wiring the same mechanism onto it would be cargo-culting with no effect, so it's left as-is.

Test plan

  • IMAGE_TAG=dc-doc:cachetest ./tools/ci/pre-commit/build_doc.sh run twice back-to-back locally (no CACHE_REF) — clean build both times, second run shows Using cache <digest> on all 12 STEPs, confirming --layers doesn't regress local caching
  • pre-commit run --files .github/workflows/doc.yaml tools/ci/pre-commit/build_doc.shcheck-yaml, shellcheck, and the build-doc hook (real strictdoc export + mdbook build) pass
  • Not verified: the actual ghcr.io cache round-trip on a live Actions run (needs this PR's own CI to exercise the new steps)

Closes #315

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

https://claude.ai/code/session_01BxvjR5XyyaEPBBpwGfUK9W

Minipada and others added 2 commits August 10, 2026 11:20
Every GitHub Actions run is a fresh VM, so podman's build cache is
otherwise local-only and never survives between runs — doc.yaml's
image (a Rust toolchain plus five `cargo install`s) was rebuilding
from scratch on every single run, cold every time.

Add CACHE_REF support to build_doc.sh, mirroring build.sh's existing
pattern for the E2E workspace image, and wire doc.yaml to log into
ghcr.io and compute a stable dc-doc-cache ref, mirroring ci.yaml's
build-workspace job. Verified locally: a second build.sh run against
the same Containerfile hits "Using cache" on every layer.

ci.yaml's build-e2e-image job also runs a bare podman build with no
cache, but its FROM is the just-built, SHA-tagged workspace image,
which changes every run — a cache keyed on the prior layer's digest
can never hit there, and the layer itself is just 3 COPYs + a chmod.
Left as-is (#315).

Closes #315

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxvjR5XyyaEPBBpwGfUK9W
Signed-off-by: David Bensoussan <d.bensoussan@proton.me>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxvjR5XyyaEPBBpwGfUK9W
Signed-off-by: David Bensoussan <d.bensoussan@proton.me>
@Minipada
Minipada merged commit 1fd33b6 into jazzy Aug 10, 2026
4 checks passed
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.48%. Comparing base (6b14911) to head (aea023b).
⚠️ Report is 2 commits behind head on jazzy.

Additional details and impacted files
@@           Coverage Diff           @@
##            jazzy     #316   +/-   ##
=======================================
  Coverage   40.48%   40.48%           
=======================================
  Files          82       82           
  Lines        5094     5094           
=======================================
  Hits         2062     2062           
  Misses       3032     3032           
Flag Coverage Δ
cpp-jazzy 40.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Minipada
Minipada deleted the feature/315-podman-build-cache branch August 16, 2026 14:12
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