From 2f9f80581ed4d824afd95b9e0661dda6933b3119 Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Fri, 13 Nov 2026 18:47:24 +0530 Subject: [PATCH] build: prune and kill the linuxkit builder by its configured name Commit f6671e0e9bfe ("Makefile.eve: Bump Linuxkit and name builder container") made the kernel's linuxkit builder run as LINUXKIT_BUILDER_NAME, linuxkit-builder-kernel-$(USER), so it does not clash with an EVE build on the same host. Two places still use the old name: - The Clean step of pr-build.yml and publish.yml tests for the builder with `docker ps -f name=linuxkit-builder`, a substring match that the renamed container satisfies, and then runs `docker exec linuxkit-builder buildctl ...`. That container does not exist on most runners ("No such container: linuxkit-builder" on the core, rt and ai legs of run 43034763427), and the `| tail` keeps the step green. Where a container really is called linuxkit-builder, the step prunes that one instead (31.66 GB on the hwe leg of the same run). Either way the kernel's own cache is never trimmed to BUILDKIT_KEEP_STORAGE_MB and keeps growing on the self-hosted runners. - `make -f Makefile.eve clean` ends with `docker kill $(BUILD_KIT_BUILDER)`. That variable is not defined, so the target always fails with '"docker kill" requires at least 1 argument'. Move the prune into a new Makefile.eve target, prune-builder, which looks the container up by LINUXKIT_BUILDER_NAME with an anchored `name=^...$` filter, so it acts on that container and no other, and keeps the existing du / prune --keep-storage / du sequence and the BUILDKIT_KEEP_STORAGE_MB override with its 32000 MB default. Both workflows call it, so the name is defined only in Makefile.eve. clean now kills $(LINUXKIT_BUILDER_NAME) and, like clean-image-%, does not fail when there is nothing to kill. Fixes: #339 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com> --- .github/workflows/pr-build.yml | 11 +---------- .github/workflows/publish.yml | 11 +---------- Makefile.eve | 23 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 53b219327756..6a08eeb3010e 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -50,13 +50,4 @@ jobs: KERNEL_CONFIG_FLAVOR=${{ matrix.flavor }} \ BRANCH=$SAFE_BRANCH \ clean-gcc - if docker ps -q -f name=linuxkit-builder | grep -q .; then - echo "=== BuildKit disk usage before prune ===" - docker exec linuxkit-builder buildctl du | tail -n 2 - echo "=== Reclaiming ===" - docker exec linuxkit-builder buildctl prune --keep-storage "${BUILDKIT_KEEP_STORAGE_MB:-32000}" | tail -n 1 - echo "=== BuildKit disk usage after prune ===" - docker exec linuxkit-builder buildctl du | tail -n 2 - else - echo "linuxkit-builder container not running; skipping BuildKit cleanup." - fi + make -f Makefile.eve prune-builder diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 35bb86a9956d..6cd974a9e328 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,13 +60,4 @@ jobs: KERNEL_CONFIG_FLAVOR=${{ matrix.flavor }} \ BRANCH=${{ github.ref_name }} \ clean-gcc - if docker ps -q -f name=linuxkit-builder | grep -q .; then - echo "=== BuildKit disk usage before prune ===" - docker exec linuxkit-builder buildctl du | tail -n 2 - echo "=== Reclaiming ===" - docker exec linuxkit-builder buildctl prune --keep-storage "${BUILDKIT_KEEP_STORAGE_MB:-32000}" | tail -n 1 - echo "=== BuildKit disk usage after prune ===" - docker exec linuxkit-builder buildctl du | tail -n 2 - else - echo "linuxkit-builder container not running; skipping BuildKit cleanup." - fi + make -f Makefile.eve prune-builder diff --git a/Makefile.eve b/Makefile.eve index b13377082b61..bb95f8eda3cb 100644 --- a/Makefile.eve +++ b/Makefile.eve @@ -124,6 +124,7 @@ help: Makefile @echo " gen-rt-fragment: regenerate RT fragment from current .config" @echo " rt-clean: revert RT patch and remove RT stamp file" @echo " clean: remove generated files" + @echo " prune-builder: trim the BuildKit cache of the linuxkit builder container" @echo .PHONY: linuxkit @@ -284,4 +285,24 @@ clean-image-%: clean: $(LK) cache clean rm -f $(LK) - docker kill $(BUILD_KIT_BUILDER) + docker kill $(LINUXKIT_BUILDER_NAME) 2>/dev/null || true + +# Trim the BuildKit cache of the linuxkit builder container down to +# BUILDKIT_KEEP_STORAGE_MB. CI runs this after every build so the cache does +# not fill the runner's disk. +# The container is named by LINUXKIT_BUILDER_NAME, not linuxkit's default +# linuxkit-builder, so it has to be looked up by that name. +BUILDKIT_KEEP_STORAGE_MB ?= 32000 + +.PHONY: prune-builder +prune-builder: + @if docker ps -q -f name='^$(LINUXKIT_BUILDER_NAME)$$' | grep -q .; then \ + echo "=== BuildKit disk usage before prune ==="; \ + docker exec $(LINUXKIT_BUILDER_NAME) buildctl du | tail -n 2; \ + echo "=== Reclaiming ==="; \ + docker exec $(LINUXKIT_BUILDER_NAME) buildctl prune --keep-storage $(BUILDKIT_KEEP_STORAGE_MB) | tail -n 1; \ + echo "=== BuildKit disk usage after prune ==="; \ + docker exec $(LINUXKIT_BUILDER_NAME) buildctl du | tail -n 2; \ + else \ + echo "$(LINUXKIT_BUILDER_NAME) container not running; skipping BuildKit cleanup."; \ + fi