]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Remove unused files from GitHub runners
authorDamian Szuberski <szuberskidamian@gmail.com>
Wed, 9 Feb 2022 19:50:13 +0000 (20:50 +0100)
committerGitHub <noreply@github.com>
Wed, 9 Feb 2022 19:50:13 +0000 (11:50 -0800)
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 <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia ZiemiaƄska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #13066

.github/workflows/scripts/reclaim_disk_space.sh [new file with mode: 0755]
.github/workflows/zfs-tests-functional.yml
.github/workflows/zfs-tests-sanity.yml

diff --git a/.github/workflows/scripts/reclaim_disk_space.sh b/.github/workflows/scripts/reclaim_disk_space.sh
new file mode 100755 (executable)
index 0000000..cc16a90
--- /dev/null
@@ -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
index a7be5f4561081a026288cd361e3068e24b376e82..40d13788a96b1de6d1a8660825b84289ab0b9bc3 100644 (file)
@@ -15,6 +15,9 @@ jobs:
     - uses: actions/checkout@v2
       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
@@ -48,15 +51,12 @@ 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: Clear the kernel ring buffer
       run: |
         sudo dmesg -c >/var/tmp/dmesg-prerun
+    - name: Report disk space
+      run: |
+        df -h /
     - name: Tests
       run: |
         /usr/share/zfs/zfs-tests.sh -vR -s 3G
index 008c5a2b48458ded81889e10a0484d66a7acdb95..ea538ce714f0acca36e0d4b3e45a92d84e5cc018 100644 (file)
@@ -11,6 +11,9 @@ jobs:
     - uses: actions/checkout@v2
       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
@@ -44,15 +47,12 @@ 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: Clear the kernel ring buffer
       run: |
         sudo dmesg -c >/var/tmp/dmesg-prerun
+    - name: Report disk space
+      run: |
+        df -h /
     - name: Tests
       run: |
         /usr/share/zfs/zfs-tests.sh -vR -s 3G -r sanity