From 3e9e1d272d093e830ce961b0a94c54feb43bb09f Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Wed, 11 Oct 2023 15:15:48 +0200 Subject: [PATCH] Reclaim GitHub Runner disk space GitHub runners provide 14GB of guaranteed available disk space, which is typically sufficient for running k0s's integration tests. However, when free space drops below 15%, Kubernetes initiates pod eviction, leaving only 5GB left on an 84GB disk until it kicks in. In response, streamline disk space usage and remove non-essential data. That's easier than globally overriding Kubernetes eviction defaults for all integration tests. Signed-off-by: Tom Wieczorek (cherry picked from commit b0579239a65c02c6960a820bc8f96899f5ba5dda) (cherry picked from commit 603e6952d67b86cd49bf528f9dc4c503f6ff963f) (cherry picked from commit be6211f673ff302dcbaaa233ab6d33ee548f8f8e) --- .github/workflows/go.yml | 6 ++++++ .../workflows/reclaim-runner-disk-space.bash | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 .github/workflows/reclaim-runner-disk-space.bash diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index fc8f460d936d..b6e102c8ebf4 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -195,6 +195,9 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v3 + - name: Reclaim runner disk space + run: .github/workflows/reclaim-runner-disk-space.bash + - name: Prepare build environment run: .github/workflows/prepare-build-env.sh @@ -290,6 +293,9 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v3 + - name: Reclaim runner disk space + run: .github/workflows/reclaim-runner-disk-space.bash + - name: Prepare build environment run: .github/workflows/prepare-build-env.sh diff --git a/.github/workflows/reclaim-runner-disk-space.bash b/.github/workflows/reclaim-runner-disk-space.bash new file mode 100755 index 000000000000..16bd8bd2f6a4 --- /dev/null +++ b/.github/workflows/reclaim-runner-disk-space.bash @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set +eux + +if [ -z "$GITHUB_RUN_ID" ]; then + echo "Cowardly refusing to destroy a machine that doesn't look like a GitHub runner." >&2 + exit 0 +fi + +df -h / + +docker system prune --all --force & +sudo rm -rf /imagegeneration/installers & +sudo rm -rf -- "${ANDROID_SDK_ROOT-/opt/nevermind}" & + +wait + +df -h /