Skip to content

Commit 6d04ba5

Browse files
ci(build): warm the main cache on an isolated docker-container builder
`--cache-to type=registry,mode=max` is unsupported on the host's default embedded docker driver unless the daemon runs the containerd image store, so on a classic store the warmer would fail to export any cache. Build the warmer on a docker-container buildx builder, which supports mode=max regardless of the host image store. It also gives the warmer its own buildkit (separate bbolt), so it never contends with PR builds on the shared embedded buildkit. Part of #2937. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent a576f33 commit 6d04ba5

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎.github/workflows/build-main.yaml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ name: Build cache (main)
88
# cache manifest -- the 409 collisions PR #2711 fixed for image tags would
99
# otherwise reappear on the cache ref. Cache is mode=max so all multistage
1010
# `builder` stages are cached, not just the final stage as with inline.
11+
#
12+
# This job builds on a docker-container buildx builder, NOT the host's default
13+
# embedded `docker` driver: `--cache-to type=registry,mode=max` is unsupported
14+
# on the docker driver unless the daemon runs the containerd image store, so on
15+
# a classic store the warmer would otherwise fail to export any cache. The
16+
# container driver also gives this build its own buildkit (separate bbolt), so
17+
# the warmer never contends with PR builds on the shared embedded buildkit.
1118

1219
env:
1320
# Same per-CI registry as pull-requests.yaml; the cache is co-located here.
@@ -55,10 +62,23 @@ jobs:
5562
env:
5663
DOCKER_CONFIG: ${{ runner.temp }}/.docker
5764

65+
# docker-container driver: required for `--cache-to type=registry,mode=max`
66+
# (unsupported on the host's default docker driver) and gives this build an
67+
# isolated buildkit so it never contends with PR builds on the shared one.
68+
- name: Set up Buildx (docker-container driver)
69+
id: buildx
70+
uses: docker/setup-buildx-action@v3
71+
with:
72+
driver: docker-container
73+
5874
- name: Build all images and write mode=max cache
5975
run: make build
6076
env:
6177
DOCKER_CONFIG: ${{ runner.temp }}/.docker
78+
# Build on the docker-container builder created above (BUILDX_ARGS adds
79+
# --builder=$(BUILDER)); buildx forwards the OCIR auth from DOCKER_CONFIG
80+
# to the container builder for cache reads/writes and image pushes.
81+
BUILDER: ${{ steps.buildx.outputs.name }}
6282
# WRITE_CACHE=1 turns on --cache-to (mode=max) for every image.
6383
WRITE_CACHE: '1'
6484
# Publish a floating :main handle; do not move :latest (releases do).

0 commit comments

Comments
 (0)