From f756d51f948f93db1a0cf3aa03bf02b2ca08f6c2 Mon Sep 17 00:00:00 2001
From: Kristian Klausen <kristian@klausen.dk>
Date: Sun, 27 Oct 2024 20:18:04 +0100
Subject: [PATCH] gitlab_runner: Boot VMs in UEFI mode

There is no technical reason for this at the moment, but UEFI is the de
facto firmware for x86-64, so let's be modern.
---
 roles/gitlab_runner/files/libvirt-executor           | 2 +-
 roles/gitlab_runner/templates/domain_template.xml.j2 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/roles/gitlab_runner/files/libvirt-executor b/roles/gitlab_runner/files/libvirt-executor
index c1aacd691..9a5bd1a39 100755
--- a/roles/gitlab_runner/files/libvirt-executor
+++ b/roles/gitlab_runner/files/libvirt-executor
@@ -89,7 +89,7 @@ run() {
 cleanup() {
   rm /run/libvirt-executor/id_ed25519_$(vm_name){,.pub}
   virsh destroy "$(vm_name)" || true
-  virsh undefine --remove-all-storage "$(vm_name)"
+  virsh undefine --nvram --remove-all-storage "$(vm_name)"
 }
 
 case "${1:-}" in
diff --git a/roles/gitlab_runner/templates/domain_template.xml.j2 b/roles/gitlab_runner/templates/domain_template.xml.j2
index 131d4922e..a7f6b7bac 100644
--- a/roles/gitlab_runner/templates/domain_template.xml.j2
+++ b/roles/gitlab_runner/templates/domain_template.xml.j2
@@ -8,7 +8,7 @@
       <entry>io.systemd.credential.binary:ssh.authorized_keys.root=$ssh_authorized_keys_root</entry>
     </oemStrings>
   </sysinfo>
-  <os>
+  <os firmware='efi'>
     <type arch='x86_64' machine='q35'>hvm</type>
     <smbios mode='sysinfo'/>
   </os>
-- 
GitLab