Skip to content

Commit 8abee04

Browse files
committed
ci/setup: Parallelize again, add timing logs
Motivation is faster provisioning and easier to debug when something goes wrong. Also cleanup the codeql cache. Signed-off-by: Colin Walters <[email protected]>
1 parent 02ecf37 commit 8abee04

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

.github/actions/bootc-ubuntu-setup/action.yml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@ inputs:
88
runs:
99
using: 'composite'
1010
steps:
11+
# The default runners have TONS of crud on them...
12+
- name: Free up disk space on runner
13+
shell: bash
14+
run: |
15+
set -xeuo pipefail
16+
sudo df -h
17+
unwanted_pkgs=('^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*'
18+
azure-cli google-chrome-stable firefox mono-devel)
19+
unwanted_dirs=(/usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL)
20+
# Start background removal operations as systemd units; if this causes
21+
# races in the future around disk space we can look at waiting for cleanup
22+
# before starting further jobs, but right now we spent a lot of time waiting
23+
# on the network and scripts and such below, giving these plenty of time to run.
24+
n=0
25+
runcleanup() {
26+
sudo systemd-run -r -u action-cleanup-${n} -- "$@"
27+
n=$(($n + 1))
28+
}
29+
runcleanup docker image prune --all --force
30+
for x in ${unwanted_dirs[@]}; do
31+
runcleanup rm -rf "$x"
32+
done
33+
# Apt removals in foreground, as we can't parallelize these
34+
for x in ${unwanted_pkgs[@]}; do
35+
/bin/time -f '%E %C' sudo apt-get remove -y $x
36+
done
1137
# We really want support for heredocs
1238
- name: Update podman and install just
1339
shell: bash
@@ -18,24 +44,9 @@ runs:
1844
test "${IDV}" = "ubuntu-24.04"
1945
# plucky is the next release
2046
echo 'deb http://azure.archive.ubuntu.com/ubuntu plucky universe main' | sudo tee /etc/apt/sources.list.d/plucky.list
21-
sudo apt update
47+
/bin/time -f '%E %C' sudo apt update
2248
# skopeo is currently older in plucky for some reason hence --allow-downgrades
23-
sudo apt install -y --allow-downgrades crun/plucky podman/plucky skopeo/plucky just
24-
# The default runners have TONS of crud on them...
25-
- name: Free up disk space on runner
26-
shell: bash
27-
run: |
28-
set -xeuo pipefail
29-
sudo df -h
30-
unwanted=('^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*'
31-
azure-cli google-chrome-stable firefox mono-devel)
32-
for x in ${unwanted[@]}; do
33-
sudo apt-get remove -y $x
34-
done
35-
# Start other removal operations in parallel
36-
sudo docker image prune --all --force
37-
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android
38-
sudo df -h
49+
/bin/time -f '%E %C' sudo apt install -y --allow-downgrades crun/plucky podman/plucky skopeo/plucky just
3950
# This is the default on e.g. Fedora derivatives, but not Debian
4051
- name: Enable unprivileged /dev/kvm access
4152
shell: bash
@@ -67,18 +78,24 @@ runs:
6778
run: |
6879
set -xeuo pipefail
6980
export BCVK_VERSION=0.5.3
70-
sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm virtiofsd libvirt-daemon-system
81+
/bin/time -f '%E %C' sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm virtiofsd libvirt-daemon-system
7182
# Something in the stack is overriding this, but we want session right now for bcvk
7283
echo LIBVIRT_DEFAULT_URI=qemu:///session >> $GITHUB_ENV
7384
td=$(mktemp -d)
7485
cd $td
7586
# Install bcvk
7687
target=bcvk-$(arch)-unknown-linux-gnu
77-
curl -LO https://github.com/bootc-dev/bcvk/releases/download/v${BCVK_VERSION}/${target}.tar.gz
88+
/bin/time -f '%E %C' curl -LO https://github.com/bootc-dev/bcvk/releases/download/v${BCVK_VERSION}/${target}.tar.gz
7889
tar xzf ${target}.tar.gz
7990
sudo install -T ${target} /usr/bin/bcvk
8091
cd -
8192
rm -rf "$td"
8293
8394
# Also bump the default fd limit as a workaround for https://github.com/bootc-dev/bcvk/issues/65
8495
sudo sed -i -e 's,^\* hard nofile 65536,* hard nofile 524288,' /etc/security/limits.conf
96+
- name: Cleanup status
97+
shell: bash
98+
run: |
99+
set -xeuo pipefail
100+
systemctl list-units 'action-cleanup*'
101+
df -h

0 commit comments

Comments
 (0)