From cb88683383bfb73c965d4a3e8d6612eb81782752 Mon Sep 17 00:00:00 2001 From: Damian Szuberski Date: Wed, 9 Feb 2022 20:50:13 +0100 Subject: [PATCH] Remove unused files from GitHub runners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Majority of the software installed by default in GitHub runners is irrelevant to OpenZFS. Reclaimed space could be used for more/bigger vdev files. File deletion happens in the background, leveraging `systemd-run` - the workflow is not significantly slowed down. Before ``` Filesystem Size Used Avail Use% Mounted on /dev/root 84G 53G 31G 63% / ``` After ``` Filesystem Size Used Avail Use% Mounted on /dev/root 84G 15G 70G 18% / ``` Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Reviewed-by: Ahelenia ZiemiaƄska Signed-off-by: szubersk Closes #13066 --- .../workflows/scripts/reclaim_disk_space.sh | 20 +++++++++++++++++++ .github/workflows/zfs-tests-functional.yml | 12 +++++------ .github/workflows/zfs-tests-sanity.yml | 12 +++++------ 3 files changed, 32 insertions(+), 12 deletions(-) create mode 100755 .github/workflows/scripts/reclaim_disk_space.sh diff --git a/.github/workflows/scripts/reclaim_disk_space.sh b/.github/workflows/scripts/reclaim_disk_space.sh new file mode 100755 index 000000000000..cc16a9079317 --- /dev/null +++ b/.github/workflows/scripts/reclaim_disk_space.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -eu + +# remove 4GiB of images +sudo systemd-run docker system prune --force --all --volumes + +# remove unused software +sudo systemd-run rm -rf \ + "$AGENT_TOOLSDIRECTORY" \ + /opt/* \ + /usr/local/* \ + /usr/share/az* \ + /usr/share/dotnet \ + /usr/share/gradle* \ + /usr/share/miniconda \ + /usr/share/swift \ + /var/lib/gems \ + /var/lib/mysql \ + /var/lib/snapd diff --git a/.github/workflows/zfs-tests-functional.yml b/.github/workflows/zfs-tests-functional.yml index beb8aaf6a69b..eef653b29dc1 100644 --- a/.github/workflows/zfs-tests-functional.yml +++ b/.github/workflows/zfs-tests-functional.yml @@ -26,6 +26,9 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Reclaim disk space + run: | + ${{ github.workspace }}/.github/workflows/scripts/reclaim_disk_space.sh - name: Install dependencies run: | sudo apt-get update @@ -67,12 +70,9 @@ jobs: sudo udevadm control --reload-rules fi fi - # Workaround to provide additional free space for testing. - # https://github.com/actions/virtual-environments/issues/2840 - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: Report disk space + run: | + df -h / - name: Tests run: | /usr/share/zfs/zfs-tests.sh -vR -s 3G diff --git a/.github/workflows/zfs-tests-sanity.yml b/.github/workflows/zfs-tests-sanity.yml index 22059130ff66..9736a85b5d06 100644 --- a/.github/workflows/zfs-tests-sanity.yml +++ b/.github/workflows/zfs-tests-sanity.yml @@ -20,6 +20,9 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Reclaim disk space + run: | + ${{ github.workspace }}/.github/workflows/scripts/reclaim_disk_space.sh - name: Install dependencies run: | sudo apt-get update @@ -61,12 +64,9 @@ jobs: sudo udevadm control --reload-rules fi fi - # Workaround to provide additional free space for testing. - # https://github.com/actions/virtual-environments/issues/2840 - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: Report disk space + run: | + df -h / - name: Tests run: | /usr/share/zfs/zfs-tests.sh -vR -s 3G -r sanity