Skip to content

Commit

Permalink
gha: Free up Github runner disk space
Browse files Browse the repository at this point in the history
We are having the below failure due to no disk space, it seems like we
can remove pre-installed software and language runtimes, which are not
use in Cilium, to reclaim more disk space.

Alternative option is to bump the runner, but it might not be the best
resource and cost utilization.

Relates: https://github.com/cilium/cilium/actions/runs/10300396788
Relates: actions/runner-images#2840 (comment)
Signed-off-by: Tam Mach <[email protected]>
  • Loading branch information
sayboras authored and joestringer committed Aug 9, 2024
1 parent 55c44d6 commit e553bd2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/actions/disk-cleanup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Disk cleanup
description: "Cleanup disk space"
runs:
using: composite
steps:
- name: Free up disk space
shell: bash
run: |
echo "Disk space before cleanup..."
df -h /
echo "Removing unnecessary files to free up disk space..."
# https://github.com/actions/runner-images/issues/2840#issuecomment-2272410832
sudo rm -rf \
/opt/hostedtoolcache \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
echo "Disk space after cleanup..."
df -h /
3 changes: 3 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ jobs:
ref: ${{ inputs.context-ref || github.sha }}
persist-credentials: false

- name: Cleanup Disk space in runner
uses: ./.github/actions/disk-cleanup

- name: Set Environment Variables
uses: ./.github/actions/set-env-variables

Expand Down

0 comments on commit e553bd2

Please sign in to comment.