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
Compare and Show latest version
1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
@@ -61,10 +61,14 @@ wait_for_vm_shutdown() {
# Create a updated VM image with the required tools
create_vm_template() {
# FIXME: Download from arch-boxes when [1] is in
# [1] https://gitlab.archlinux.org/archlinux/arch-boxes/-/merge_requests/172
local vm_name
printf -v vm_name 'libvirt_executor_vm_template_%(%s)T_tmp'
local latest_image="$(curl -fs "${MIRROR}/images/latest/" | grep -Eo 'Arch-Linux-x86_64-cloudimg-[0-9]{8}\.[0-9]+\.qcow2'| head -n 1)"
if [ -z "${latest_image}" ]; then
echo "Error: Couldn't find latest cloud image"
exit 1
fi
local image_path="${LIBVIRT_DEFAULT_POOL_PATH}/${vm_name}.qcow2"
trap 'rm -f -- "${image_path}"' EXIT
curl -sSf "${MIRROR}/images/v20210815.31636/Arch-Linux-x86_64-cloudimg-20210815.31636.qcow2" --output "${image_path}"
Loading