Compare commits

...

4 Commits

Author SHA1 Message Date
f3571105e8 chore: Test API call method
All checks were successful
build-image / Semantic Release (Dry-run) (push) Successful in 2m0s
build-image / Build image (push) Successful in 15m40s
2025-09-05 07:29:17 +10:00
4312ac55fe build: Rebase act-runner container image
All checks were successful
build-image / Semantic Release (Dry-run) (push) Successful in 50s
build-image / Build image (push) Successful in 26m13s
2025-08-20 10:05:01 +10:00
1d9e7c912a Update cloud-init/user-data.template
All checks were successful
build-image / Semantic Release (Dry-run) (push) Successful in 2m41s
build-image / Build image (push) Successful in 20m30s
2025-08-07 07:50:49 +00:00
f04226c147 build: Upload image artifact to repository/hypervisor
All checks were successful
build-image / Semantic Release (Dry-run) (push) Successful in 38s
build-image / Build image (push) Successful in 16m33s
2025-07-30 21:07:19 +10:00
2 changed files with 42 additions and 15 deletions

View File

@@ -29,8 +29,6 @@ jobs:
--analyzeCommits @semantic-release/commit-analyzer \
--verifyRelease @semantic-release/exec \
--verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
env:
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
- name: Assert semantic release output
run: |
[[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
@@ -41,6 +39,7 @@ jobs:
build_image:
name: Build image
container: code.spamasaurus.com/djpbessems/act-runner-extended:1.0.0-cth20250815
runs-on: ubuntu-latest
needs: semrel_dryrun
steps:
@@ -50,15 +49,9 @@ jobs:
run: |
apt-get update && \
apt-get install -y \
gettext \
genisoimage \
libguestfs-tools \
linux-image-generic \
linux-modules-extra-$(uname -r) \
linux-headers-generic \
qemu-system-x86 \
qemu-utils \
supermin
linux-headers-generic
mkdir -p \
$PWD/ubuntu-vm \
@@ -67,10 +60,10 @@ jobs:
run: |
curl -L \
https://sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2024.04/ubuntu-24.04-server-cloudimg-amd64.img \
-o ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img \
-o ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img \
-u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }}
qemu-img resize ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img +5G
qemu-img resize ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img +5G
- name: Generate seed ISO
run: |
envsubst < cloud-init/user-data.template > cloud-init/user-data
@@ -82,8 +75,8 @@ jobs:
-rock \
cloud-init/meta-data cloud-init/user-data
env:
ROOT_HASHED_PASSWORD: ${{ secrets.ROOT_HASHED_PASSWORD }}
PUBLIC_SSHKEY: ${{ secrets.PUBLIC_SSHKEY }}
ROOT_HASHED_PASSWORD: ${{ secrets.VM_ROOT_HASHED_PASSWORD }}
PUBLIC_SSHKEY: ${{ secrets.VM_PUBLIC_SSHKEY }}
- name: Provision template virtual machine
run: |
[ -e /dev/kvm ] && kvm_flag="-enable-kvm" || kvm_flag=""
@@ -93,7 +86,7 @@ jobs:
-m 3072 \
-smp 2 \
-cpu host \
-drive file=ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img,if=virtio,format=qcow2 \
-drive file=ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img,if=virtio,format=qcow2 \
-drive file=ubuntu-vm/seed.iso,format=raw,media=cdrom \
-nographic \
-net nic \
@@ -102,10 +95,43 @@ jobs:
-chardev socket,path=qga.sock,server=on,wait=off,id=qga0 \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0
if ! guestfish --ro -a ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img -i stat /var/log/template-generation-success; then
if ! guestfish --ro -a ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img -i stat /var/log/template-generation-success; then
echo "VM provisioning encountered errors - exiting"
exit 1
fi
- name: Compress image file
run: |
virt-sparsify --compress \
ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img \
ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}-compacted.img
- name: Upload image file
run: |
REPO_TOKEN=$(curl -fsSL -X POST \
http://filebrowser.filebrowser.svc.cluster.local:80/api/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "${{ secrets.REPO_PASSWORD }}"}' \
)
curl -fsSL -X POST \
http://filebrowser.filebrowser.svc.cluster.local:80/api/resources/rel/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img?override=true \
--header "X-Auth: $REPO_TOKEN" \
--upload-file "ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}-compacted.img"
curl -ksS -X PUT "https://lab-hv-vip.bessems.lan/v1/harvesterhci.io.virtualmachineimages" \
-H "Authorization: Bearer ${{ secrets.HV_TOKEN }}" \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"type": "harvesterhci.io.virtualmachineimage",
"metadata": {
"namespace": "default"
},
"spec": {
"displayName": "ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}",
"sourceType": "download",
"url": "https://${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }}@sn.itch.fyi/Repository/rel/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img"
}
}
EOF
# semrel:
# name: Semantic Release

View File

@@ -12,6 +12,7 @@ packages:
runcmd:
- apt-get install -y linux-modules-extra-$(uname -r)
- sed -i '/"${distro_id}:${distro_codename}-updates"/s|^//||' /etc/apt/apt.conf.d/50unattended-upgrades
- sysctl -w net.ipv6.conf.all.disable_ipv6=1
- systemctl enable --now qemu-guest-agent.service
- cloud-init clean --logs