build: Assert successful completion of cloud-init
Some checks failed
build-image / Build image (push) Failing after 6m15s
Some checks failed
build-image / Build image (push) Failing after 6m15s
This commit is contained in:
@ -50,23 +50,29 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Create folder structure
|
- name: Set up build container
|
||||||
run: |
|
run: |
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
gettext \
|
||||||
|
genisoimage \
|
||||||
|
libguestfs-tools \
|
||||||
|
qemu-system-x86 \
|
||||||
|
qemu-utils
|
||||||
|
|
||||||
mkdir -p \
|
mkdir -p \
|
||||||
ubuntu-vm
|
$PWD/ubuntu-vm \
|
||||||
|
/mnt/vmimage
|
||||||
- name: Download source Ubuntu iso
|
- name: Download source Ubuntu iso
|
||||||
run: |
|
run: |
|
||||||
curl -L \
|
curl -L \
|
||||||
https://sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2024.04/ubuntu-24.04-server-cloudimg-amd64.img \
|
https://sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2024.04/ubuntu-24.04-server-cloudimg-amd64.img \
|
||||||
-o ubuntu-vm/ubuntu.img \
|
-o ubuntu-vm/ubuntu.img \
|
||||||
-u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }}
|
-u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }}
|
||||||
|
|
||||||
|
qemu-img resize ubuntu-vm/ubuntu.img +5G
|
||||||
- name: Generate seed ISO
|
- name: Generate seed ISO
|
||||||
run: |
|
run: |
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y \
|
|
||||||
gettext \
|
|
||||||
genisoimage
|
|
||||||
|
|
||||||
envsubst < cloud-init/user-data.template > cloud-init/user-data
|
envsubst < cloud-init/user-data.template > cloud-init/user-data
|
||||||
|
|
||||||
genisoimage \
|
genisoimage \
|
||||||
@ -78,15 +84,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ROOT_HASHED_PASSWORD: ${{ secrets.ROOT_HASHED_PASSWORD }}
|
ROOT_HASHED_PASSWORD: ${{ secrets.ROOT_HASHED_PASSWORD }}
|
||||||
PUBLIC_SSHKEY: ${{ secrets.PUBLIC_SSHKEY }}
|
PUBLIC_SSHKEY: ${{ secrets.PUBLIC_SSHKEY }}
|
||||||
- name: Start virtual machine
|
- name: Provision template virtual machine
|
||||||
run: |
|
run: |
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y \
|
|
||||||
qemu-system-x86 \
|
|
||||||
qemu-utils
|
|
||||||
|
|
||||||
qemu-img resize ubuntu-vm/ubuntu.img +5G
|
|
||||||
|
|
||||||
[ -e /dev/kvm ] && kvm_flag="-enable-kvm" || kvm_flag=""
|
[ -e /dev/kvm ] && kvm_flag="-enable-kvm" || kvm_flag=""
|
||||||
|
|
||||||
qemu-system-x86_64 \
|
qemu-system-x86_64 \
|
||||||
@ -98,11 +97,15 @@ jobs:
|
|||||||
-drive file=ubuntu-vm/seed.iso,format=raw,media=cdrom \
|
-drive file=ubuntu-vm/seed.iso,format=raw,media=cdrom \
|
||||||
-nographic \
|
-nographic \
|
||||||
-net nic \
|
-net nic \
|
||||||
-net user
|
-net user \
|
||||||
|
-device virtio-serial-pci,id=virtio-serial0 \
|
||||||
|
-chardev socket,path=qga.sock,server=on,wait=off,id=qga0 \
|
||||||
|
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0
|
||||||
|
|
||||||
qemu-img convert -O qcow2 ubuntu-vm/ubuntu.img ubuntu-vm/ubuntu-compacted.img
|
if ! strings ubuntu-vm/ubuntu.img | grep -q TEMPLATE_GENERATION_SUCCESS; then
|
||||||
|
echo "VM provisioning encountered errors - exiting"
|
||||||
ls -lash ubuntu-vm
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# semrel:
|
# semrel:
|
||||||
# name: Semantic Release
|
# name: Semantic Release
|
||||||
|
@ -18,7 +18,7 @@ runcmd:
|
|||||||
- truncate -s 0 /etc/hostname /etc/machine-id
|
- truncate -s 0 /etc/hostname /etc/machine-id
|
||||||
- rm -f /etc/ssh/ssh_host_* /var/lib/dbus/machine-id
|
- rm -f /etc/ssh/ssh_host_* /var/lib/dbus/machine-id
|
||||||
- ln -s /etc/machine-id /var/lib/dbus/machine-id
|
- ln -s /etc/machine-id /var/lib/dbus/machine-id
|
||||||
- poweroff
|
- echo "TEMPLATE_GENERATION_SUCCESS" > /var/log/template-generation-success
|
||||||
|
|
||||||
disable_root: false
|
disable_root: false
|
||||||
users:
|
users:
|
||||||
@ -30,3 +30,8 @@ users:
|
|||||||
- ${PUBLIC_SSHKEY}
|
- ${PUBLIC_SSHKEY}
|
||||||
ssh_authorized_keys:
|
ssh_authorized_keys:
|
||||||
- ${PUBLIC_SSHKEY}
|
- ${PUBLIC_SSHKEY}
|
||||||
|
|
||||||
|
power_state:
|
||||||
|
delay: now
|
||||||
|
mode: poweroff
|
||||||
|
condition: true
|
||||||
|
Reference in New Issue
Block a user