CI: remove unused packages/snaps

Removing portions of packages/snaps directly with rm can result in
unexpected errors when running `apt update`.  Free up the additional
space by removing (some) packages with the proper tools.

This change frees up slightly less space than before, but it is
expected to still be sufficient.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #14374
This commit is contained in:
Brian Behlendorf 2023-01-11 15:18:51 -08:00 committed by GitHub
parent 6f2ffd272c
commit 6320b9e68e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -1,20 +1,19 @@
#!/bin/sh #!/bin/sh -x
set -eu set -eu
# remove 4GiB of images # remove 4GiB of images
sudo systemd-run docker system prune --force --all --volumes sudo systemd-run docker system prune --force --all --volumes
# remove unused packages
sudo apt remove -q --purge firefox
# remove unused software # remove unused software
sudo systemd-run rm -rf \ sudo systemd-run rm -rf \
"$AGENT_TOOLSDIRECTORY" \ "$AGENT_TOOLSDIRECTORY" \
/opt/* \ /opt/* \
/usr/local/* \ /usr/local/* \
/usr/share/az* \ /usr/share/az* \
/usr/share/dotnet \
/usr/share/gradle* \ /usr/share/gradle* \
/usr/share/miniconda \ /usr/share/miniconda \
/usr/share/swift \ /usr/share/swift
/var/lib/gems \
/var/lib/mysql \
/var/lib/snapd