mkosi-based Gitea runner OS and job image
os / os (push) Failing after 45s
job / job (push) Failing after 1m3s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-12 22:43:46 +01:00
commit d4eebeb01f
33 files changed
+529

No files matched your search

@@ -0,0 +1,8 @@
# DHCP on the real network cards. Kind=!* skips virtual links like the veths of podman's bridges,
# which netavark manages.
[Match]
Type=ether
Kind=!*
[Network]
DHCP=yes
@@ -0,0 +1,9 @@
# Services enabled in the image (mkosi runs systemctl preset-all).
enable systemd-networkd.service
enable systemd-resolved.service
enable nftables.service
enable podman.socket
enable gitea-runner-setup.service
enable gitea-runner.service
enable systemd-sysupdate-update.timer
enable systemd-sysupdate-reboot.timer
@@ -0,0 +1,17 @@
# Pulls the base images that jobs share read-only (see /usr/lib/gitea-runner/config.yaml) before the
# runner starts, so no job uses them while they change. Hosts reboot to update, so this runs about
# as often as there are updates.
[Unit]
Description=Base images for Gitea Actions jobs
Wants=network-online.target
After=network-online.target
Before=gitea-runner.service
[Service]
Type=oneshot
Environment=IMAGES=/var/lib/containers/base-images
# Without network the runner still starts, with the images it has.
ExecStart=-/usr/bin/podman --root ${IMAGES} --runroot /run/containers/base-images pull -q --policy newer \
quay.io/fedora/fedora:45 quay.io/fedora/fedora-minimal:45
ExecStart=/usr/bin/podman --root ${IMAGES} --runroot /run/containers/base-images image prune -f
TimeoutStartSec=30min
@@ -0,0 +1,17 @@
# First boot: asks for the root password and the runner's registration on the console (tty1).
[Unit]
Description=Gitea runner first-boot setup
ConditionPathExists=!/etc/gitea-runner/runner.env
Before=getty@tty1.service kmsconvt@tty1.service
[Service]
Type=oneshot
ExecStart=/usr/libexec/gitea-runner-setup
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty1
TTYReset=yes
TTYVHangup=yes
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,24 @@
# The Gitea Actions runner. Registers itself on its first start.
[Unit]
Description=Gitea Actions runner
Wants=network-online.target gitea-runner-images.service
After=network-online.target podman.socket gitea-runner-images.service
Requires=podman.socket
[Service]
# The runner drives root's podman (podman.socket.d gives this user the socket). The jobs it starts
# never get the socket (see config.yaml).
User=gitea-runner
WorkingDirectory=/var/lib/gitea-runner
EnvironmentFile=/etc/gitea-runner/runner.env
Environment=DOCKER_HOST=unix:///run/podman/podman.sock
# Register once; the result is kept in .runner.
ExecStartPre=/bin/sh -c '[ -f .runner ] || exec gitea-runner register --no-interactive --config /usr/lib/gitea-runner/config.yaml --instance "$GITEA_INSTANCE_URL"'
ExecStart=/usr/bin/gitea-runner daemon --config /usr/lib/gitea-runner/config.yaml
Restart=on-failure
# A bit longer than runner.shutdown_timeout, so running jobs can finish on stop.
TimeoutStopSec=35min
RestartSec=10s
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,6 @@
# Load our firewall (/usr/lib/gitea-runner/firewall.nft) instead of /etc/sysconfig/nftables.conf.
[Service]
ExecStart=
ExecStart=/usr/sbin/nft -f /usr/lib/gitea-runner/firewall.nft
ExecReload=
ExecReload=/usr/sbin/nft -f /usr/lib/gitea-runner/firewall.nft
@@ -0,0 +1,4 @@
# The runner may use root's podman. Jobs never get this socket.
[Socket]
SocketGroup=gitea-runner
SocketMode=0660
@@ -0,0 +1,5 @@
# Daily at about 04:10, reboot into a downloaded update. Stop the runner first: it takes no new
# jobs and lets running ones finish (runner.shutdown_timeout).
[Service]
ExecStartPre=/bin/sh -c '/usr/lib/systemd/systemd-sysupdate pending || exit 0; systemctl stop gitea-runner'
TimeoutStartSec=40min