Skip to content

Commit

Permalink
Reclaim GitHub Runner disk space
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit b057923)
(cherry picked from commit 603e695)
(cherry picked from commit be6211f)
  • Loading branch information
twz123 authored and github-actions[bot] committed Oct 12, 2023
1 parent f2a90cd commit 3e9e1d2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/reclaim-runner-disk-space.bash
Original file line number Diff line number Diff line change
@@ -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 /

0 comments on commit 3e9e1d2

Please sign in to comment.