build: Upload image artifact to webserver
All checks were successful
build-image / Semantic Release (Dry-run) (push) Successful in 22s
build-image / Build image (push) Successful in 10m14s

This commit is contained in:
2025-07-30 15:42:41 +10:00
parent c1dc3f3839
commit 35b48b7164

View File

@ -29,8 +29,8 @@ 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 }}
# env:
# GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
- name: Assert semantic release output
run: |
[[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
@ -67,10 +67,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 +82,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 +93,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 +102,39 @@ 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: Upload template
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 }}.img"
# curl -ksS -X POST "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": {
# "name": "ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}",
# "namespace": "default"
# },
# "spec": {
# "displayName": "ubuntu-24.04.2-rke2-v${{ needs.semrel_dryrun.outputs.version }}",
# "sourceType": "upload"
# }
# }
# EOF
# semrel:
# name: Semantic Release