Repository navigation
[amd64-v6.18.63-generic] build: prune and kill the linuxkit builder by its configured name - #341
Open
NopeCharon wants to merge 1 commit into
Conversation
Commit f6671e0 ("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: lf-edge#339 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since the builder container was renamed to
LINUXKIT_BUILDER_NAME(linuxkit-builder-kernel-$(USER), commit f6671e0), the CI Clean step no longer prunes the kernel's BuildKit cache, andmake -f Makefile.eve cleanalways fails. This PR moves the prune into a Makefile.eve target that uses the configured name, and fixesclean.Fixes #339
What was wrong
pr-build.yml/publish.ymlClean step:docker ps -f name=linuxkit-builderis a substring match, so it finds the renamed container. The step then runsdocker exec linuxkit-builder ...against a container that usually does not exist. In publish run 43034763427 the core, rt and ai legs printError response from daemon: No such container: linuxkit-builderthree times each. The hwe leg's runner does have a container named exactlylinuxkit-builder(31.66 GB), so the step pruned that one instead. Because of the| tail, the step passes in every case.clean:docker kill $(BUILD_KIT_BUILDER)refers to a variable that does not exist, so it runsdocker killwith no argument and fails.Changes
prune-buildertarget in Makefile.eve. It finds the container with an anchoredname=^$(LINUXKIT_BUILDER_NAME)$filter and runs the same du /prune --keep-storage/ du sequence as before.BUILDKIT_KEEP_STORAGE_MBcan still be overridden from the environment and still defaults to 32000. The target is listed inhelp.make -f Makefile.eve prune-builder, so the builder name is defined only in Makefile.eve.cleankills$(LINUXKIT_BUILDER_NAME). Likeclean-image-%, it ignores the error when there is nothing to kill.Validation
XandX-kernel-runnerrunning, the oldname=Xfilter matches both, andname=^X$/name=^X-kernel-runner$each match only their own container. With the builder absent,prune-builderprints the skip message and exits 0. The test containers were removed afterwards.dockerstub on PATH:linuxkit-builder-kernel-runnerandlinuxkit-builderare both running,prune-builderrunsdu,prune --keep-storage 32000andduonlinuxkit-builder-kernel-runneronly.linuxkit-builderis running, it skips.BUILDKIT_KEEP_STORAGE_MBandLINUXKIT_BUILDER_NAMEfrom the environment are honoured.make cleannow runsdocker kill linuxkit-builder-kernel-runnerand exits 0. On the base branch it fails with"docker kill" requires at least 1 argument.Note: the 31.66 GB
linuxkit-buildercontainer on the hwe runner of that run is no longer touched by CI. If nothing else on that host uses it, it can be removed by hand.