Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 1 addition & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 22 additions & 1 deletion Makefile.eve
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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