From 2eae0da145a9ff676f24a792b29e862baa086778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Sun, 1 Feb 2026 15:23:41 +0100 Subject: [PATCH] github: Deal with new Github images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .github/workflows/tests.yml | 50 +++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 25e62e103..7d96f75ac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -352,21 +352,28 @@ jobs: run: | make + - name: Setup scratch space + if: "matrix.backend == 'ceph' || matrix.backend == 'linstor'" + run: | + set -eux + + if mountpoint -q /mnt; then + [ -e /mnt/swapfile ] && sudo swapoff /mnt/swapfile + block_path="$(findmnt --noheadings --output SOURCE --target /mnt | sed 's/[0-9]\+$//')" + sudo umount /mnt + sudo wipefs -a "${block_path}" + sudo ln -s "${block_path}" "/dev/scratch" + else + sudo truncate -s 20G /scratch.img + block_path="$(sudo losetup --show -f /scratch.img)" + sudo ln -s "${block_path}" "/dev/scratch" + fi + - name: Setup MicroCeph - if: ${{ matrix.backend == 'ceph' }} + if: matrix.backend == 'ceph' run: | set -x - # If the rootfs and the ephemeral part are on the same physical disk, giving the whole - # disk to microceph would wipe our rootfs. Since it is pretty rare for GitHub Action - # runners to have a single disk, we immediately bail rather than trying to gracefully - # handle it. Once snapd releases with https://github.com/snapcore/snapd/pull/13150, - # we will be able to stop worrying about that special case. - if [ "$(stat -c '%d' /)" = "$(stat -c '%d' /mnt)" ]; then - echo "FAIL: rootfs and ephemeral part on the same disk, aborting" - exit 1 - fi - sudo apt-get install --no-install-recommends -y snapd sudo snap install microceph --channel=quincy/stable sudo apt-get install --no-install-recommends -y ceph-common @@ -379,11 +386,9 @@ jobs: for flag in nosnaptrim noscrub nobackfill norebalance norecover noscrub nodeep-scrub; do sudo microceph.ceph osd set $flag done + # Repurpose the ephemeral disk for ceph OSD. - sudo swapoff /mnt/swapfile - ephemeral_disk="$(findmnt --noheadings --output SOURCE --target /mnt | sed 's/[0-9]\+$//')" - sudo umount /mnt - sudo microceph disk add --wipe "${ephemeral_disk}" + sudo microceph disk add --wipe "/dev/scratch" sudo rm -rf /etc/ceph sudo ln -s /var/snap/microceph/current/conf/ /etc/ceph sudo microceph enable rgw @@ -393,6 +398,7 @@ jobs: sudo microceph.ceph fs ls sleep 30 sudo microceph.ceph status + # Wait until there are no more "unkowns" pgs for _ in $(seq 60); do if sudo microceph.ceph pg stat | grep -wF unknown; then @@ -405,16 +411,10 @@ jobs: sudo rm -f /snap/bin/rbd - name: Setup LINSTOR - if: ${{ matrix.backend == 'linstor' }} + if: matrix.backend == 'linstor' run: | set -x - # As with Ceph, we hope for a spare disk. - if [ "$(stat -c '%d' /)" = "$(stat -c '%d' /mnt)" ]; then - echo "FAIL: rootfs and ephemeral part on the same disk, aborting" - exit 1 - fi - sudo add-apt-repository ppa:linbit/linbit-drbd9-stack -y # Install everything required to compile DRBD and run LINSTOR tools. @@ -437,11 +437,7 @@ jobs: sudo linstor node create local "${runner_ip}" --node-type combined # Repurpose the ephemeral disk for LINSTOR physical storage. - sudo swapoff /mnt/swapfile - ephemeral_disk="$(findmnt --noheadings --output SOURCE --target /mnt | sed 's/[0-9]\+$//')" - sudo umount /mnt - sudo wipefs -a "${ephemeral_disk}" - sudo linstor physical-storage create-device-pool --storage-pool incus --pool-name linstor-incus zfsthin local "${ephemeral_disk}" + sudo linstor physical-storage create-device-pool --storage-pool incus --pool-name linstor-incus zfsthin local "/dev/scratch" # Update the runner env. echo "INCUS_LINSTOR_CLUSTER=${runner_ip}" >> "$GITHUB_ENV"