Skip to content
Snippets Groups Projects
Verified Commit bd299d85 authored by Kristian Klausen's avatar Kristian Klausen :tada:
Browse files

Add libvirt-executor image for our GitLab Runner custom executor

We have provided a custom executor[1] for a few years[2] now. It uses
the "basic" image which is modified on each runner to include the
relevant packages and tweaks.

Modifying the image is cumbersome (convert qcow2 to raw, losesetup,
arch-chroot, convert raw to qcow2 etc.) and requires administrative
privileges on the runner. The arch-boxes project already has all the
needed infrastructure for doing these kinds of "modifications", so let's
just add a extra image with all the needed packages and tweaks and
remove the complexity from the infrastructure repository.

The required changes to the custom executor can be found in this
infrastructure MR[3] and this image is based on the "modified image"
from said MR, before the switch over.

[1] https://docs.gitlab.com/runner/executors/custom.html
[2] infrastructure!385
[3] infrastructure!881
parent 48ccb457
No related branches found
No related tags found
No related merge requests found
Pipeline #112290 passed
......@@ -42,6 +42,8 @@ shfmt:
name: "output"
paths:
- "output/*"
# Workaround until https://gitlab.com/gitlab-org/gitlab/-/issues/352644 is sorted
- build.env
expire_in: 2d
reports:
metrics: metrics.txt
......@@ -186,7 +188,9 @@ publish:
- pacman -Syu --needed --noconfirm vagrant
script:
- |
for file in output/*; do
shopt -s extglob
# The libvirt-executor image is not meant for external consumption!
for file in output/!(*libvirt-executor*); do
base="$(basename "${file}")"
curl -sSf --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "${file}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/images/v${BUILD_VERSION}/${base}"
done
......
#!/bin/bash
# shellcheck disable=SC2034,SC2154
IMAGE_NAME="Arch-Linux-x86_64-libvirt-executor-${build_version}.qcow2"
DISK_SIZE="40G"
PACKAGES=(git git-lfs gitlab-runner)
SERVICES=()
function pre() {
arch-chroot "${MOUNT}" /usr/bin/systemctl disable systemd-time-wait-sync
sed -E 's/^#(IgnorePkg *=)/\1 linux/' -i "${MOUNT}/etc/pacman.conf"
sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"$/\1 lockdown=confidentiality"/' -i "${MOUNT}/etc/default/grub"
arch-chroot "${MOUNT}" /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg
# We want to use the transient hostname
# https://github.com/systemd/systemd/pull/30814
rm -f "${MOUNT}/etc/hostname"
cat <<EOF >"${MOUNT}/etc/systemd/network/80-dhcp.network"
[Match]
Name=en*
Name=eth*
[Network]
DHCP=yes
EOF
}
function post() {
qemu-img convert -c -f raw -O qcow2 "${1}" "${2}"
rm "${1}"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment