From 8e22de79c163bcc14df3029b2f2c05c7e63f4721 Mon Sep 17 00:00:00 2001
From: Kristian Klausen <kristian@klausen.dk>
Date: Sun, 27 Oct 2024 16:41:12 +0100
Subject: [PATCH] Revert "gitlab_runner: Initial the keyring in the base image
 for faster boot"

This reverts commit 466230e41e21fbabeb922909ec226fc6f4d8bab3.

This has been fixed in pacman[1], so it is no longer unreasonably slow.
Some quick testing at runner1 indicates that this only saves five
seconds at best, so IMO it is not worth the complexity to continue doing
this.

This revert does not revert the timeout back to 60 seconds, but keeps it
at 30 seconds.

[1] https://gitlab.archlinux.org/pacman/pacman/-/merge_requests/16
---
 .../files/libvirt-executor-update-base-image              | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/roles/gitlab_runner/files/libvirt-executor-update-base-image b/roles/gitlab_runner/files/libvirt-executor-update-base-image
index d8e063e77..d669d16d3 100755
--- a/roles/gitlab_runner/files/libvirt-executor-update-base-image
+++ b/roles/gitlab_runner/files/libvirt-executor-update-base-image
@@ -30,9 +30,7 @@ qemu-img convert -f qcow2 -O raw Arch-Linux-x86_64-basic.qcow2 Arch-Linux-x86_64
 
 loopdev="$(losetup --find --partscan --show "${image}")"
 mount --mkdir "${loopdev}p3" mnt
-
-arch-chroot mnt pacman-key --init
-arch-chroot mnt pacman-key --populate
+mount --mkdir --bind -o ro /etc/pacman.d/gnupg mnt/etc/pacman.d/gnupg
 
 arch-chroot mnt systemctl disable systemd-time-wait-sync
 arch-chroot mnt pacman -Sy --noconfirm --needed archlinux-keyring
@@ -47,8 +45,8 @@ rm -f mnt/etc/machine-id mnt/etc/hostname
 
 cp -a mnt/boot/{initramfs-linux-fallback.img,initramfs-linux.img}
 
-rm -r mnt/etc/pacman.d/gnupg/{openpgp-revocs.d,private-keys-v1.d}/
-arch-chroot mnt pacman-key --delete pacman@localhost
+umount mnt/etc/pacman.d/gnupg
+rmdir mnt/etc/pacman.d/gnupg
 umount mnt
 losetup -d "${loopdev}"
 loopdev=""
-- 
GitLab