Repository navigation
Description
Problem
The release writes the build cache of the service, runner and mcp-server images to the GitHub Actions cache (type=gha, release.yml:433, 574 and 710). In run 44415593173 the three exports took 140.6, 61.3 and 140.2 s, and the repository cache use is 10.5 GB. The devcontainer release already writes a registry cache (release.yml:218-219), and its export took 14.4 s.
Change
- In release.yml:433, 574 and 710, set
cache-to: type=registry,ref=ghcr.io/dan-petty/devops-cli/<image>:buildcache,mode=max. - Read the same ref with
cache-fromin the ci.yml image jobs, service-image-test.yml and release.yml. The release stays the only cache writer (perf(ci): stop the cache export of pull request image builds #4646). - Change
tests/gate/tree_checks/image_cache.pyand the requirement 'Each image build keeps its own gha cache scope' ofopenspec/specs/container-image-layersto the registry ref. - A retention job must keep the
:buildcachetag (ci(cleanup): prune untagged GHCR images and old attestation tags #4816). - This changes the premise of test(ci): verify per-image cache scopes after two releases #5942 (verify per-image gha cache scopes after two releases).
Renovate. No change.
Risk. The first release after the merge has a cold cache. The packages are public, so a read needs no credentials.
Proof
- The release step 'exporting cache to registry' takes less time than today's gha export (140.6, 61.3 and 140.2 s in run 44415593173).
- After the old blobs go,
uv run devops gh api repos/dan-petty/devops-cli/actions/cache/usageshows less than today's 10.5 GB. - A PR build log shows CACHED steps from the registry.
Depends on: none
Alternatives check of 2026-11-19: not-applicable.
Class: perf, no search.
Tool: none found.
Proposed design
Problem statement
The release writes the build cache of the service, runner and mcp-server images to the GitHub Actions cache. In run 44415593173 the three exports took 140.6, 61.3 and 140.2 s, and the repository cache use is 10.5 GB. The devcontainer release writes a registry cache instead, and its export took 14.4 s. This change moves the three caches to ghcr.io/dan-petty/devops-cli/<image>:buildcache with mode=max. It keeps release.yml as the only writer. It makes the ci.yml image jobs and service-image-test.yml read the same ref. It also changes the tree check and the container-image-layers spec delta.
Acceptance criteria
Requirement: Release reads and writes the registry cache
The release.yml image builds of service, runner and mcp-server SHALL read and write ghcr.io/dan-petty/devops-cli/<image>:buildcache with cache-from: type=registry and cache-to: type=registry,...,mode=max, and SHALL write no type=gha entry.
Scenario: Tree check passes on the release workflow
- WHEN
uv run devops ci --check --only test-treeruns on the changedrelease.yml - THEN it exits 0 and prints no failure line for
release.yml.
Requirement: Read jobs reuse the registry cache
The image jobs of ci.yml and service-image-test.yml SHALL read cache-from: type=registry,ref=ghcr.io/dan-petty/devops-cli/<image>:buildcache and SHALL write no cache.
Scenario: Tree check passes on the read jobs
- WHEN
uv run devops ci --check --only test-treeruns on the changedci.ymlandservice-image-test.yml - THEN it exits 0 and prints no failure line for either workflow.
Requirement: Tree check enforces the registry ref
tests/gate/tree_checks/image_cache.py SHALL require a registry cache-to with mode=max and a registry cache-from with :buildcache for each image build, and SHALL report a type=gha entry as a failure.
Scenario: Tree check passes on the changed tree
- WHEN
uv run devops ci --check --only test-treeruns - THEN it exits 0 and prints no failure line.
Requirement: Spec delta names the registry ref
The change's spec delta for container-image-layers SHALL replace the per-image gha scope with the per-image registry :buildcache ref.
Scenario: OpenSpec validates the change
- WHEN
uv run openspec validate --strictruns - THEN it exits 0 and reports no validation error.
Existing Tool Considered
The alternatives check of 2026-11-19 records not-applicable for this perf item, with no search and tool none found; the issue body holds the check. The check names no tool and lists no coverage or gap. The open, maintained tool that covers the need is the BuildKit registry cache backend (type=registry). docker/setup-buildx-action provides it, and the devcontainer release already uses it at .github/workflows/release.yml:218-219. The proposal writes mode=max to the per-image tag ghcr.io/dan-petty/devops-cli/<image>:buildcache and reads the same tag from the CI jobs. The backend has no policy to remove old cache blobs or to keep the :buildcache tag. The retention job of #4816 must keep the tag. The first release after the merge reads a cold cache. The GHCR packages are public, so a read needs no credentials.
Key questions
- Which workflow cache entries change?:
release.ymlhascache-toat lines 433, 574 and 710 andcache-fromat lines 375 and 430.ci.ymlhascache-fromat lines 490, 609 and 723.service-image-test.ymlhas onecache-fromfor the service image. Each entry moves to the registry ref of its image. [sources: .github/workflows/release.yml:375, .github/workflows/release.yml:430, .github/workflows/release.yml:433, .github/workflows/release.yml:574, .github/workflows/release.yml:710, .github/workflows/ci.yml:490, .github/workflows/ci.yml:609, .github/workflows/ci.yml:723, .github/workflows/service-image-test.yml] - Which cache backend do the three image builds use?: Use the BuildKit registry cache backend (
type=registry) at a per-image GHCR tag. (best practice) [sources: .github/workflows/release.yml:218, .github/workflows/release.yml:433]- Rejected: GitHub Actions cache (
type=gha). The three exports took 140.6, 61.3 and 140.2 s, and the repository cache use is 10.5 GB. - Chosen: Registry cache (
type=registry). The devcontainer release already uses it atrelease.yml:218-219, and its export took 14.4 s.
- Rejected: GitHub Actions cache (
- Which tag holds the cache of each image?: Use one tag for each image:
ghcr.io/dan-petty/devops-cli/<image>:buildcache. (best practice) [sources: tests/gate/tree_checks/image_cache.py, .github/workflows/release.yml:433]- Chosen: Per-image tag. Each build keeps its own cache, and the tree check already requires a per-target scope.
- Rejected: One shared tag. A second image replaces the cache index of the first image.
- Which job writes the registry cache?: Only
release.ymlwrites the cache. Theci.ymlimage jobs andservice-image-test.ymlonly read it. (best practice) [sources: .github/workflows/release.yml:433, .github/workflows/ci.yml:490, .github/workflows/service-image-test.yml]- Chosen: Release only. One writer prevents concurrent jobs from replacing the same tag, and it keeps perf(ci): stop the cache export of pull request image builds #4646.
- Rejected: Every image build. The CI and release jobs would replace the same tag at the same time.
- Which cache mode does the export use?: Use
mode=max, because it keeps all layers and the tree check requires it for acache-to. (best practice) [sources: tests/gate/tree_checks/image_cache.py]- Chosen:
mode=max. It keeps the full layer cache, and the tree check requires it for a write. - Rejected:
mode=min. It keeps only the final layer, so a later build restores less.
- Chosen:
- How does the tree check enforce the registry ref?: Rewrite both checks of
tests/gate/tree_checks/image_cache.py. Eachcache-tomust name a registry ref withmode=max. Eachcache-frommust name the registry ref with:buildcache. Atype=ghaentry is a failure. (best practice) [sources: tests/gate/tree_checks/image_cache.py]- Chosen: Rewrite the two existing checks. They already check the scope of each entry and the
mode=maxof a write. - Rejected: Add a third check. It duplicates the scope and mode checks and leaves the old
ghachecks in place.
- Chosen: Rewrite the two existing checks. They already check the scope of each entry and the
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 19, 2026
Both concern image build cache in the same workflow files, but the candidate changes the cache mechanism to a registry ref while #5942 verifies per-image gha cache scopes after two releases.devops-cli-service commentedon Nov 19, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
devops-cli-service commentedon Nov 19, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
perf(ci): keep the image build cache in GHCR
perf(ci): keep the image build cache in GHCR
test(ci): drop the cache value check and the cleanup tag edit (#6404)
perf(ci): keep the image build cache in GHCR
test(ci): drop the cache value check and the cleanup tag edit (#6404)
chore(main): release 0.183.2 (#6541)
devops-cli-service commentedon Nov 20, 2026
Released in v0.183.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.183.2
devops-cli-service commentedon Nov 20, 2026
Live since 2026-11-20 18:13 UTC