Make clone-and-register work
This commit is contained in:
parent
dd377c3ade
commit
e6dc52d27e
|
@ -24,7 +24,8 @@ other KVM based virtualization solution.
|
|||
The script `build-forgejorunner-template.sh` runs on a Proxmox cluster host.
|
||||
It runs the build script via SSH on a builder VM (that has nested virtualization
|
||||
enabled), in case of CCCHH a Debian 12 install. It then copies the resulting VM to the
|
||||
Proxmox host.
|
||||
Proxmox host. **Note**: at the time of this writing, the builder VM needs at
|
||||
least 16 cores to satisfy the KVMn config for the VM being built.
|
||||
|
||||
It creates a template VM from the image, installing https://code.forgejo.org/forgejo/runner
|
||||
and some helper scripts.
|
||||
|
|
|
@ -16,8 +16,8 @@ vm_name=template-forgejo-runner
|
|||
vm_bridge=vmbr4
|
||||
vm_storage="local-zfs"
|
||||
|
||||
#ssh ${builder_host} sudo sh <${builder_script}
|
||||
#scp ${builder_host}:${runner_image} .
|
||||
ssh ${builder_host} sudo sh <${builder_script}
|
||||
scp ${builder_host}:${runner_image} .
|
||||
|
||||
wget --output-document=forgejo-runner ${forgejo_runner_url}
|
||||
wget -N https://git.hamburg.ccc.de/CCCHH/infrastructure-authorized-keys/raw/branch/trunk/authorized_keys
|
||||
|
|
17
clone-and-register.sh
Normal file → Executable file
17
clone-and-register.sh
Normal file → Executable file
|
@ -4,14 +4,20 @@
|
|||
# Clone the template VM and register the runner with Forgejo
|
||||
#
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "usage: $0 vmid registration-token"
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "usage: $0 vmid name registration-token"
|
||||
exit 64
|
||||
fi
|
||||
|
||||
vm_id="$1"
|
||||
token="$2"
|
||||
set -e
|
||||
|
||||
vm_id="$1"
|
||||
vm_name="$2"
|
||||
token="$3"
|
||||
|
||||
qm clone 9042 ${vm_id} --full true --name "${vm_name}"
|
||||
qm set ${vm_id} --ipconfig0 ip=172.31.17.203/25,gw=172.31.17.129
|
||||
|
||||
qm clone 9042 ${vm_id}
|
||||
qm start ${vm_id}
|
||||
while :; do
|
||||
qm agent ${vm_id} ping && break
|
||||
|
@ -19,6 +25,7 @@ while :; do
|
|||
sleep 10
|
||||
done
|
||||
|
||||
echo "VM ${vm_id} started, trying to register runner..."
|
||||
qm guest exec ${vm_id} -- sudo -iu forgejo-runner register-forgejo-runner "${token}"
|
||||
qm guest exec ${vm_id} -- systemctl restart forgejo-runner
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Clone the template VM and register the new VM as a Forgejo runner
|
||||
#
|
Loading…
Reference in a new issue