From 8151350d20e12f895986ac1d35b6f3644d0f94e0 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 28 Jul 2025 22:44:52 +1000 Subject: [PATCH] build: Assert successful completion of cloud-init --- .gitea/workflows/actions.yaml | 5 ++--- cloud-init/user-data.template | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/actions.yaml b/.gitea/workflows/actions.yaml index 04f50fc..b6547c8 100644 --- a/.gitea/workflows/actions.yaml +++ b/.gitea/workflows/actions.yaml @@ -82,6 +82,7 @@ jobs: run: | apt-get update && \ apt-get install -y \ + libguestfs-tools \ qemu-system-x86 \ qemu-utils @@ -100,9 +101,7 @@ jobs: -net nic \ -net user - qemu-img convert -O qcow2 ubuntu-vm/ubuntu.img ubuntu-vm/ubuntu-compacted.img - - ls -lash ubuntu-vm + virt-ls -a ubuntu-vm/ubuntu.img /var/lib/cloud-init/ | grep -q template-generation-success # semrel: # name: Semantic Release diff --git a/cloud-init/user-data.template b/cloud-init/user-data.template index cb84c68..7ecd257 100644 --- a/cloud-init/user-data.template +++ b/cloud-init/user-data.template @@ -18,7 +18,7 @@ runcmd: - truncate -s 0 /etc/hostname /etc/machine-id - rm -f /etc/ssh/ssh_host_* /var/lib/dbus/machine-id - ln -s /etc/machine-id /var/lib/dbus/machine-id - - poweroff + - touch /var/lib/cloud-init/template-generation-success disable_root: false users: @@ -30,3 +30,8 @@ users: - ${PUBLIC_SSHKEY} ssh_authorized_keys: - ${PUBLIC_SSHKEY} + +power_state: + delay: now + mode: poweroff + condition: true