Repository navigation
Description
Problem Description
All image builds of ci.yml, release.yml and service-image-test.yml use the GitHub Actions cache (type=gha) with no scope, so they share the default scope buildkit. Each cache-to replaces the cache index of that scope. release.yml builds the Service, runner and MCP server images in parallel jobs (service-image, runner-image and mcp-server-image, each with needs: release-please), so the job that ends last decides which stages the next build can find.
#4872 (#4550) puts the dependencies of the runner and Service images in the cached stages runner-deps and service-deps, and k8s/README.md (Image paragraph) says that a release keeps those layers. But at the next release, the dependency stages of at least one image are not in the cache. They build again, give new layer digests, and each node pulls them again. So the 10 s container start that #4550 expects is not sure.
Reproduction Steps
git grep -n "type=gha" .github/workflowsonmain: 19 entries, none withscope=.- Read the cache list of
main:devops gh api "repos/{owner}/{repo}/actions/caches?key=index-buildkit&ref=refs/heads/main". It holds one index for all image builds,index-buildkit-1-f921bd05#907(2026-11-12). - The Docker documentation of the cache backend (https://docs.docker.com/build/cache/backends/gha/, section Scope) gives the default scope
buildkitand says: "If you build multiple images, each build will overwrite the cache of the previous, leaving only the final cache."
Expected vs Actual Behavior
Expected: each build of an image reads and writes the cache in a scope named after its target (scope=service, scope=runner, scope=mcp-server), so a release finds the dependency stages that the last build of the same image on main wrote, and keeps their layers.
Actual: all builds share one index, and a release finds the cached stages of only the image that the last build made.
Proposed Fix
- Set
cache-from: type=gha,scope=<target>andcache-to: type=gha,scope=<target>,mode=maxon each image build ofci.ymlandrelease.yml, andcache-from: type=gha,scope=serviceinservice-image-test.yml. A build with notargetbuildsservice. - Add an invariant test in
tests/invariants/test_image_layers.py: eachtype=ghaentry ofcache-fromandcache-toof a build of./Dockerfilenamesscope=with its target. This test fails onmainwith 19 entries and passes with the fix. - Add one sentence about the scopes to the Image paragraph of
k8s/README.md, and a requirement to the speccontainer-image-layers. - perf(ci): stop the cache export of pull request image builds #4646 removes the cache export of the pull request image builds and changes the same lines. One of the two pull requests rebases on the other.
Existing tool: the scope parameter of the BuildKit gha cache backend. No code. Cost: about 20,000 tokens and 1 hour. A registry cache per image (type=registry) has no 10 GB limit, but the pull request builds have only contents: read and cannot write it.
Acceptance Criteria
- Each
type=ghaentry of an image build namesscope=with its target, and the test fails when one does not. - After the merge, the cache list of
mainholds one index for each of the scopesservice,runnerandmcp-server. - At the second release after the merge, the push of the Service and runner images uploads only the project layer and the apt upgrade layer: the dependency layers of the release before keep their digests.
Environment Diagnostics
- Repository cache: 12,577,035,846 bytes in 309 entries, against a limit of 10 GB (
actions/cache/usage,actions/cache/storage-limit, 2026-11-12). GitHub evicts the entries that nobody read for the longest time, so a stage whose blobs it evicts also builds again. A scope does not change that, and perf(ci): stop the cache export of pull request image builds #4646 lowers the size.
Logs, Traces, or Terminal Output
None. The evidence is the configuration, the documentation and the cache list above. Found by the review of #4872.
Alternatives check of 2026-11-15: none.
Tool: none found.
Proposed design
Problem statement
All image builds in ci.yml, release.yml and service-image-test.yml use the BuildKit gha cache with the default scope buildkit. The parallel release jobs replace one cache index, so a release cannot find the dependency stages of every image. The change gives each image target its own cache scope and adds an invariant test.
Acceptance criteria
Requirement: Per-target gha cache scope
Each image build of ./Dockerfile SHALL set cache-from: type=gha,scope=<target> and cache-to: type=gha,scope=<target>,mode=max.
Scenario: Release builds use three scopes
- WHEN The invariant test reads the Service, runner and MCP server builds in release.yml.
- THEN It finds scope=service, scope=runner and scope=mcp-server, and each cache-to entry sets mode=max.
Requirement: Service image test reads the service scope
The Service image build in service-image-test.yml SHALL read the gha cache with scope=service.
Scenario: The pull request image test uses the service cache
- WHEN The invariant test reads service-image-test.yml.
- THEN It finds
cache-from: type=gha,scope=servicefor the Service image build.
Requirement: Invariant rejects an unscoped cache entry
The invariant test SHALL fail when a cache-from or cache-to entry of an image build lacks scope=.
Scenario: An unscoped cache entry fails the test
- WHEN A workflow has
cache-to: type=ghawith no scope. - THEN The test fails and names the workflow file and the line.
Requirement: Image documentation names the scopes
The Image paragraph of k8s/README.md SHALL state that each image build uses its target as its gha cache scope.
Scenario: The Image paragraph lists the scopes
- WHEN A docs check reads the Image paragraph of k8s/README.md.
- THEN It finds the scopes service, runner and mcp-server.
Requirement: Spec records per-image cache scopes
The container-image-layers spec SHALL state that each image build uses a gha cache scope named after its target.
Scenario: The spec delta adds the cache scope requirement
- WHEN A checker reads the change's spec delta for container-image-layers.
- THEN It finds the requirement and a scenario that name the service, runner and mcp-server scopes.
Existing Tool Considered
No open, maintained tool covers the need. The alternatives check of 2026-11-15 found none. The BuildKit gha cache backend provides the scope parameter, but it does not set per-image scopes or add the invariant test. The change edits the workflows and adds the test, at about 20,000 tokens and 1 hour.
Key questions
- Which cache scope does each image build use?: Use the image target as the scope: service, runner and mcp-server. A build of ./Dockerfile with no target uses service. (best practice) [sources: .github/workflows/ci.yml, .github/workflows/release.yml, .github/workflows/service-image-test.yml]
- Chosen: Target name. The target names the image and stays stable across workflows.
- Rejected: Workflow name. One workflow builds several images, so the scopes would collide.
- Rejected: Default buildkit scope. It makes each build replace the cache index of the other images.
- How does the repository keep the scopes in place?: Add tests/invariants/test_image_layers.py. It reads the three workflows and fails when a cache-from or cache-to entry of ./Dockerfile lacks scope=. (best practice) [sources: tests/invariants/test_k8s_manifests.py]
- Chosen: Invariant test. It checks each workflow offline and blocks a regression in CI.
- Rejected: Review checklist. A person can miss one of the many cache entries.
- Rejected: No check. The default scope returns when a build copies an old entry.
- Which cache export mode does each cache-to entry use?: Use mode=max. It exports the dependency stages, and the default min mode does not. (best practice) [sources: .github/workflows/release.yml]
- Chosen: mode=max. It exports every stage, including the runner-deps and service-deps stages.
- Rejected: mode=min. It exports only the final stage and leaves the dependency stages out.
- How does the change record the scopes in the documentation and the spec?: Add one sentence to the Image paragraph of k8s/README.md and one requirement to the container-image-layers spec delta. (best practice) [sources: k8s/README.md, openspec/specs/container-image-layers/spec.md]
- Chosen: README and spec. The project records image behavior in both places.
- Rejected: README only. The spec would not state the cache rule.
- Rejected: Spec only. A reader of the k8s README would not see the scopes.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(ci)scope of the title gives the scope.The shared cache scope causes release builds to rebuild dependency layers and miss the 10 s start goal, but it does not block the pipeline.It restores the expected cache hit for each image at release time and keeps the dependency-layer digests stable across releases.The fix is a parameter change on existing cache lines, one invariant test, and one README sentence, estimated at about one hour.Both modify the same type=gha lines in ci.yml, but #4646 removes PR cache exports while this candidate adds a per-image scope to keep release caches correct.perf(ci): stop the cache export of pull request image builds (#5113)
devops-cli-service commentedon Nov 15, 2026
Alternatives check: none
Reason: The searches returned nothing but the Docker documentation of the BuildKit
ghacache backend, whose built-inscopeparameter (defaultbuildkit) is exactly the mechanism the issue already names: the docs state that each build overwrites the previous cache unless a per-image scope is set. No open tool or library provides per-image cache scopes or the repository-specific invariant test, so the need is a configuration change to this project's own workflow files, not an adoption of a tool.Tool: none found
Lacks:
scope=on thetype=ghacache entries ofci.yml,release.ymlandservice-image-test.yml; the workflows themselves must be edited.tests/invariants/test_image_layers.pythat fails when an image build omitsscope=.k8s/README.mdor thecontainer-image-layersspec requirement.Searches run:
Sources:
Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 16, 2026
Status set to Ready at fccb781 (see proposed design in issue body).
Moved to new items: #5942.
chore(main): release 0.174.7 (#6255)
devops-cli-service commentedon Nov 18, 2026
Released in v0.174.7: https://github.com/dan-petty/devops-cli/releases/tag/v0.174.7
devops-cli-service commentedon Nov 18, 2026
Live since 2026-11-18 04:24 UTC