From c3c6aa833a961c12669fa118b83e87633758d9d6 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 27 Jul 2025 22:05:09 +1000 Subject: [PATCH] build: Explicitly start libvirt daemon in container --- .gitea/workflows/actions.yaml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/actions.yaml b/.gitea/workflows/actions.yaml index 8513de0..bf6a2da 100644 --- a/.gitea/workflows/actions.yaml +++ b/.gitea/workflows/actions.yaml @@ -54,6 +54,20 @@ jobs: run: | mkdir -p \ ubuntu-vm + - name: Assert source Ubuntu ISO + run: | + # TODO: Make this path configurable in a yaml file + # TODO: Add checksum verification + # d6dab0c3a657988501b4bd76f1297c053df710e06e0c3aece60dead24f270b4d *ubuntu-24.04.2-live-server-amd64.iso + + [[ -f '/iso/Canonical/Ubuntu Server 24.04/ubuntu-24.04.2-live-server-amd64.iso' ]] && { + echo 'Source iso file exists - creating symbolic link' + ln -s "/iso/Canonical/Ubuntu Server 24.04/ubuntu-24.04.2-live-server-amd64.iso" ubuntu-vm/ubuntu.iso + + ls ubuntu-vm -lash + } || { + echo 'Missing source iso file - exiting'; exit 1 + } - name: Generate seed ISO run: | apt-get update && \ @@ -72,12 +86,6 @@ jobs: env: ROOT_HASHED_PASSWORD: ${{ secrets.ROOT_HASHED_PASSWORD }} PUBLIC_SSHKEY: ${{ secrets.PUBLIC_SSHKEY }} - - name: Assert source Ubuntu ISO - run: | - # TODO: Make this path configurable in a yaml file - [[ ! -f '/iso/Canonical/Ubuntu Server 24.04/ubuntu-24.04.2-desktop-amd64.iso' ]] || { - echo 'Missing source iso file - exiting'; exit 1 - } - name: Create empty QCOW2 disk run: | apt-get update && \ @@ -86,10 +94,16 @@ jobs: qemu-img create -f qcow2 ubuntu-vm/ubuntu.qcow2 10G - name: Run virt-install + # container: quay.io/kubevirt/libvirt run: | apt-get update && \ apt-get install -y \ - virtinst + libvirt-daemon-system \ + libvirt-clients \ + virtinst \ + qemu-utils + + libvirtd -d virt-install \ --name ubuntu-harvester \ @@ -97,7 +111,7 @@ jobs: --vcpus 2 \ --disk path=ubuntu-vm/ubuntu.qcow2,size=10,format=qcow2 \ --disk path=ubuntu-vm/seed.iso,device=cdrom \ - --cdrom '/iso/Canonical/Ubuntu Server 24.04/ubuntu-24.04.2-desktop-amd64.iso' \ + --cdrom ubuntu-vm/ubuntu.iso \ --os-variant ubuntu24.04 \ --graphics none \ --network network=default \