Skip to content

Commit

Permalink
Remove unused files from GitHub runners
Browse files Browse the repository at this point in the history
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 openzfs#13066
  • Loading branch information
szubersk authored and usaleem-ix committed Dec 17, 2022
1 parent ca5ca05 commit cb88683
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/scripts/reclaim_disk_space.sh
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions .github/workflows/zfs-tests-functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/zfs-tests-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cb88683

Please sign in to comment.