Skip to content
Snippets Groups Projects

gitlab_runner: Add VM based executor (libvirt-executor)

Merged Kristian Klausen requested to merge klausenbusk/infrastructure:custom-executor into master
3 files
+ 27
2
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -2,9 +2,10 @@
set -o nounset -o errexit -o pipefail
readonly MIRROR="https://mirror.pkgbuild.com"
readonly LIBVIRT_DEFAULT_POOL_PATH="/var/lib/libvirt/images"
readonly STATE_DIR="/usr/local/lib/libvirt-executor"
ssh() {
command ssh -i foo_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=off "root@${vm_ip}" "${@}"
command ssh -i "${STATE_DIR}/id_rsa" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=off "root@${vm_ip}" "${@}"
}
get_vm_ip() {
@@ -65,7 +66,7 @@ create_vm_template() {
qemu-img resize "${image_path}" 10G
trap "virsh destroy ${vm_name}; virsh undefine ${vm_name} --remove-all-storage; exit 1" EXIT
virt-install --name "${vm_name}" \
--cloud-init user-data=$PWD/user-data \
--cloud-init "user-data=${STATE_DIR}/user-data" \
--disk path="${image_path}",device=disk \
--os-type Linux \
--os-variant archlinux \
Loading