forgejo-runner-pve-ubuntu-l.../clone-and-register.sh
2024-07-27 09:58:18 +02:00

25 lines
467 B
Bash

#!/bin/sh
#
# Clone the template VM and register the runner with Forgejo
#
if [ $# -ne 2 ]; then
echo "usage: $0 vmid registration-token"
fi
vm_id="$1"
token="$2"
qm clone 9042 ${vm_id}
qm start ${vm_id}
while :; do
qm agent ${vm_id} ping && break
echo "waiting for VM ${vm_id} to complete boot..."
sleep 10
done
qm guest exec ${vm_id} -- sudo -iu forgejo-runner register-forgejo-runner "${token}"
qm guest exec ${vm_id} -- systemctl restart forgejo-runner