Skip to content

Commit 90070ce

Browse files
committed
ci: Test bootc-ubuntu-setup with arm64 fixes
Copy the bootc-ubuntu-setup action locally and fix: 1. Use correct apt mirror for arm64 (ports.ubuntu.com/ubuntu-ports) 2. Handle missing /dev/kvm on arm64 runners gracefully Also syncs other improvements from upstream actions repo. Assisted-by: OpenCode (Claude claude-opus-4-5)
1 parent bda73c7 commit 90070ce

2 files changed

Lines changed: 42 additions & 38 deletions

File tree

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

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ runs:
1414
run: |
1515
set -xeuo pipefail
1616
sudo df -h
17-
unwanted_pkgs=('^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*'
17+
# Use globs for package patterns (apt and dpkg both support fnmatch globs)
18+
unwanted_pkgs=('aspnetcore-*' 'dotnet-*' 'llvm-*' 'php*' 'mongodb-*' 'mysql-*'
1819
azure-cli google-chrome-stable firefox mono-devel)
1920
unwanted_dirs=(/usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL)
2021
# Start background removal operations as systemd units; if this causes
@@ -30,9 +31,12 @@ runs:
3031
for x in ${unwanted_dirs[@]}; do
3132
runcleanup rm -rf "$x"
3233
done
33-
# Apt removals in foreground, as we can't parallelize these
34+
# Apt removals in foreground, as we can't parallelize these.
35+
# Only attempt removal if matching packages are installed.
3436
for x in ${unwanted_pkgs[@]}; do
35-
/bin/time -f '%E %C' sudo apt-get remove -y $x
37+
if dpkg -l "$x" >/dev/null 2>&1; then
38+
/bin/time -f '%E %C' sudo apt-get remove -y "$x"
39+
fi
3640
done
3741
# We really want support for heredocs
3842
- name: Update podman and install just
@@ -43,7 +47,22 @@ runs:
4347
IDV=$(. /usr/lib/os-release && echo ${ID}-${VERSION_ID})
4448
test "${IDV}" = "ubuntu-24.04"
4549
# plucky is the next release
46-
echo 'deb http://azure.archive.ubuntu.com/ubuntu plucky universe main' | sudo tee /etc/apt/sources.list.d/plucky.list
50+
# Ubuntu uses different mirrors for different architectures:
51+
# - amd64: azure.archive.ubuntu.com/ubuntu (on Azure runners)
52+
# - arm64: ports.ubuntu.com/ubuntu-ports
53+
case "$(arch)" in
54+
x86_64)
55+
mirror="http://azure.archive.ubuntu.com/ubuntu"
56+
;;
57+
aarch64)
58+
mirror="http://ports.ubuntu.com/ubuntu-ports"
59+
;;
60+
*)
61+
echo "Unsupported architecture: $(arch)" >&2
62+
exit 1
63+
;;
64+
esac
65+
echo "deb ${mirror} plucky universe main" | sudo tee /etc/apt/sources.list.d/plucky.list
4766
/bin/time -f '%E %C' sudo apt update
4867
# skopeo is currently older in plucky for some reason hence --allow-downgrades
4968
/bin/time -f '%E %C' sudo apt install -y --allow-downgrades crun/plucky podman/plucky skopeo/plucky just
@@ -54,31 +73,27 @@ runs:
5473
set -xeuo pipefail
5574
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
5675
sudo udevadm control --reload-rules
57-
sudo udevadm trigger --name-match=kvm
58-
ls -l /dev/kvm
76+
# Only trigger if /dev/kvm exists (may not be available on arm64 runners)
77+
if [ -e /dev/kvm ]; then
78+
sudo udevadm trigger --name-match=kvm
79+
ls -l /dev/kvm
80+
else
81+
echo "Note: /dev/kvm not available on this runner"
82+
fi
5983
# Used by a few workflows, but generally useful
6084
- name: Set architecture variable
6185
id: set_arch
6286
shell: bash
6387
run: echo "ARCH=$(arch)" >> $GITHUB_ENV
64-
# We often use Rust, so set up opinionated default caching
65-
- name: Setup Rust cache
66-
uses: Swatinem/rust-cache@v2
67-
with:
68-
cache-all-crates: true
69-
# Only generate caches on push to git main
70-
save-if: ${{ github.ref == 'refs/heads/main' }}
71-
# Suppress actually using the cache for builds running from
72-
# git main so that we avoid incremental compilation bugs
73-
lookup-only: ${{ github.ref == 'refs/heads/main' }}
7488
# Install libvirt stack if requested
7589
- name: Install libvirt and virtualization stack
7690
if: ${{ inputs.libvirt == 'true' }}
7791
shell: bash
7892
run: |
7993
set -xeuo pipefail
80-
export BCVK_VERSION=0.6.0
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
94+
export BCVK_VERSION=0.10.0
95+
# see https://github.com/bootc-dev/bcvk/issues/176
96+
/bin/time -f '%E %C' sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm virtiofsd libvirt-daemon-system python3-virt-firmware
8297
# Something in the stack is overriding this, but we want session right now for bcvk
8398
echo LIBVIRT_DEFAULT_URI=qemu:///session >> $GITHUB_ENV
8499
td=$(mktemp -d)

.github/workflows/debug-arm64-upterm.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,18 @@ jobs:
1919
cat /etc/os-release
2020
df -h
2121
22-
- name: Test plucky apt mirror fix
22+
- name: Test local bootc-ubuntu-setup action
23+
uses: ./.github/actions/bootc-ubuntu-setup
24+
25+
- name: Verify setup worked
2326
run: |
24-
set -eux
25-
# This is the proposed fix - use correct mirror per architecture
26-
case "$(arch)" in
27-
x86_64)
28-
mirror="http://azure.archive.ubuntu.com/ubuntu"
29-
;;
30-
aarch64)
31-
mirror="http://ports.ubuntu.com/ubuntu-ports"
32-
;;
33-
*)
34-
echo "Unsupported architecture: $(arch)" >&2
35-
exit 1
36-
;;
37-
esac
38-
echo "Using mirror: ${mirror}"
39-
echo "deb ${mirror} plucky universe main" | sudo tee /etc/apt/sources.list.d/plucky.list
40-
/bin/time -f '%E %C' sudo apt update
41-
# Test that we can actually install packages from plucky
42-
apt-cache policy podman
27+
set -x
28+
podman --version
29+
just --version
30+
echo "Setup completed successfully!"
4331
4432
- name: Setup upterm session
33+
if: failure()
4534
uses: owenthereal/action-upterm@v1
4635
with:
4736
limit-access-to-actor: true

0 commit comments

Comments
 (0)