Compare commits

..

2 Commits

Author SHA1 Message Date
6a63e2eda2 chore: Attempt interacting w/ Harvester REST API
Some checks failed
build-image / Semantic Release (Dry-run) (push) Successful in 35s
build-image / Build image (push) Failing after 8m55s
2025-07-29 22:14:59 +10:00
547be8b390 chore: Rename secret names for consistency 2025-07-29 20:57:59 +10:00
2 changed files with 20 additions and 27 deletions

View File

@@ -29,6 +29,8 @@ jobs:
--analyzeCommits @semantic-release/commit-analyzer \ --analyzeCommits @semantic-release/commit-analyzer \
--verifyRelease @semantic-release/exec \ --verifyRelease @semantic-release/exec \
--verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT' --verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
# env:
# GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
- name: Assert semantic release output - name: Assert semantic release output
run: | run: |
[[ -z "${{ steps.sem_rel.outputs.version }}" ]] && { [[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
@@ -39,7 +41,6 @@ jobs:
build_image: build_image:
name: Build image name: Build image
container: code.spamasaurus.com/djpbessems/act-runner-extended:1.0.0-cth20250815
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: semrel_dryrun needs: semrel_dryrun
steps: steps:
@@ -49,9 +50,15 @@ jobs:
run: | run: |
apt-get update && \ apt-get update && \
apt-get install -y \ apt-get install -y \
gettext \
genisoimage \
libguestfs-tools \
linux-image-generic \ linux-image-generic \
linux-modules-extra-$(uname -r) \ linux-modules-extra-$(uname -r) \
linux-headers-generic linux-headers-generic \
qemu-system-x86 \
qemu-utils \
supermin
mkdir -p \ mkdir -p \
$PWD/ubuntu-vm \ $PWD/ubuntu-vm \
@@ -60,10 +67,10 @@ jobs:
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-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img \ -o ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img \
-u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }} -u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }}
qemu-img resize ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img +5G qemu-img resize ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img +5G
- name: Generate seed ISO - name: Generate seed ISO
run: | run: |
envsubst < cloud-init/user-data.template > cloud-init/user-data envsubst < cloud-init/user-data.template > cloud-init/user-data
@@ -86,7 +93,7 @@ jobs:
-m 3072 \ -m 3072 \
-smp 2 \ -smp 2 \
-cpu host \ -cpu host \
-drive file=ubuntu-vm/ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img,if=virtio,format=qcow2 \ -drive file=ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img,if=virtio,format=qcow2 \
-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 \
@@ -95,44 +102,31 @@ jobs:
-chardev socket,path=qga.sock,server=on,wait=off,id=qga0 \ -chardev socket,path=qga.sock,server=on,wait=off,id=qga0 \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0
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 if ! guestfish --ro -a ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img -i stat /var/log/template-generation-success; then
echo "VM provisioning encountered errors - exiting" echo "VM provisioning encountered errors - exiting"
exit 1 exit 1
fi fi
- name: Compress image file - name: Upload template
run: | run: |
virt-sparsify --compress \ curl -sS -X POST "https://lab-hv-vip.bessems.lan/v1/harvesterhci.io.virtualmachinetemplates" \
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 "Authorization: Bearer ${{ secrets.HV_TOKEN }}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d @- <<EOF -d @- <<EOF
{ {
"type": "harvesterhci.io.virtualmachineimage", "type": "harvesterhci.io.virtualmachineimage",
"metadata": { "metadata": {
"name": "ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}",
"namespace": "default" "namespace": "default"
}, },
"spec": { "spec": {
"displayName": "ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}", "displayName": "ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}",
"sourceType": "download", "sourceType": "upload"
"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 EOF
sleep 7200
# semrel: # semrel:
# name: Semantic Release # name: Semantic Release
# runs-on: ubuntu-latest # runs-on: ubuntu-latest

View File

@@ -12,7 +12,6 @@ packages:
runcmd: runcmd:
- apt-get install -y linux-modules-extra-$(uname -r) - 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 - sysctl -w net.ipv6.conf.all.disable_ipv6=1
- systemctl enable --now qemu-guest-agent.service - systemctl enable --now qemu-guest-agent.service
- cloud-init clean --logs - cloud-init clean --logs