Run jobs in our own job image
os / os (push) Failing after 2m42s

mkosi.images/job/ builds an OCI image with git, Node.js 26 and dnf, and
the OS ships it in /usr, so it is signed and updated with the OS.
gitea-runner.service loads it at boot instead of pulling Fedora, and
JavaScript actions work without installing Node.js in each job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-22 17:48:04 +00:00
1 parent 460bdbe380
commit d1c7c55700
7 files changed
+43 -10

No files matched your search

+3 -3
View File
@@ -26,9 +26,9 @@ jobs:
packages: write packages: write
steps: steps:
- name: Install tools - name: Install tools
run: dnf install -yq mkosi git-core run: dnf install -yq mkosi
# Check out fetches the commit with git, which needs no Node.js and no # Check out fetches the commit with git, so it needs no action from
# action from GitHub. gitea-runner 6 removed builtin:checkout. # GitHub. gitea-runner 6 removed builtin:checkout.
- name: Check out - name: Check out
env: env:
AUTH: "Authorization: token ${{ gitea.token }}" AUTH: "Authorization: token ${{ gitea.token }}"
+2 -1
View File
@@ -11,7 +11,8 @@ image.
- **Encrypted with a TPM:** everything that isn't read-only, such as `/etc` - **Encrypted with a TPM:** everything that isn't read-only, such as `/etc`
and `/var`, is encrypted. The TPM unlocks it only for correctly signed UKIs. and `/var`, is encrypted. The TPM unlocks it only for correctly signed UKIs.
- **Jobs in containers:** each job runs in its own privileged container on - **Jobs in containers:** each job runs in its own privileged container on
root's podman, by default in plain Fedora (`runs-on: linux`). Privileged root's podman. Jobs with `runs-on: linux` run in our job image: Fedora with
git, Node.js 26 and dnf, built with the OS and shipped in `/usr`. Privileged
jobs can build OS images, but can also take over the VM, so only use it for jobs can build OS images, but can also take over the VM, so only use it for
repositories you trust. Container storage is wiped at every boot. repositories you trust. Container storage is wiped at every boot.
- **Self-updating:** the image rebuilds weekly. The VM lets running jobs finish - **Self-updating:** the image rebuilds weekly. The VM lets running jobs finish
+7
View File
@@ -9,6 +9,11 @@
# - mkosi.prepare installs the runner, which Fedora doesn't package. # - mkosi.prepare installs the runner, which Fedora doesn't package.
# - mkosi.finalize keeps /etc in /usr/share/factory/etc. # - mkosi.finalize keeps /etc in /usr/share/factory/etc.
# - mkosi.version gives each build its version. # - mkosi.version gives each build its version.
# - mkosi.images/job/ builds the job image.
[Config]
# Dependencies builds the job image first, so ExtraTrees= can copy it in.
Dependencies=job
[Distribution] [Distribution]
Distribution=fedora Distribution=fedora
@@ -28,6 +33,7 @@ ManifestFormat=json
# the name the runner registers with. # the name the runner registers with.
# - WithDocs leaves out man pages. The image has no man to read them. # - WithDocs leaves out man pages. The image has no man to read them.
# - Packages lists the packages installed into the image. # - Packages lists the packages installed into the image.
# - ExtraTrees copies the job image (mkosi.images/job/) into /usr.
# - UnifiedKernelImageFormat names the UKI runneros_<version>.efi, which # - UnifiedKernelImageFormat names the UKI runneros_<version>.efi, which
# matches the MatchPattern= of mkosi.extra/usr/lib/sysupdate.d/20-uki.transfer. # matches the MatchPattern= of mkosi.extra/usr/lib/sysupdate.d/20-uki.transfer.
# - KernelCommandLine: # - KernelCommandLine:
@@ -70,6 +76,7 @@ Packages=
curl curl
procps-ng procps-ng
iproute iproute
ExtraTrees=%O/job:/usr/lib/runneros/job
UnifiedKernelImageFormat=%i_%v UnifiedKernelImageFormat=%i_%v
KernelCommandLine= KernelCommandLine=
quiet quiet
+3 -1
View File
@@ -11,8 +11,10 @@ runner:
# shutdown_timeout lets running jobs finish when the runner stops, as it # shutdown_timeout lets running jobs finish when the runner stops, as it
# does before an update reboots the machine. # does before an update reboots the machine.
shutdown_timeout: 1h shutdown_timeout: 1h
# labels names the job image of jobs with runs-on: linux, which
# gitea-runner.service loads at boot.
labels: labels:
- linux:docker://quay.io/fedora/fedora:45 - linux:docker://localhost/runneros-job
container: container:
# privileged lets jobs build OS images, as this repository's own workflow # privileged lets jobs build OS images, as this repository's own workflow
# does. A job can then take over the machine, so only run jobs you trust. # does. A job can then take over the machine, so only run jobs you trust.
@@ -14,10 +14,11 @@ Requires=podman.socket
# HOME holds the cache of actions/cache, next to the registration. # HOME holds the cache of actions/cache, next to the registration.
Environment=HOME=/var/lib/gitea-runner Environment=HOME=/var/lib/gitea-runner
Environment=DOCKER_HOST=unix:///run/podman/podman.sock Environment=DOCKER_HOST=unix:///run/podman/podman.sock
# ExecStartPre pulls the image of the linux label in # ExecStartPre loads the job image (mkosi.images/job/) from /usr into podman,
# /etc/gitea-runner/config.yaml, so the first job after a boot doesn't wait # whose storage is wiped at every boot, under the name that the linux label in
# for it. The runner still starts if it fails. # /etc/gitea-runner/config.yaml uses. podman names nothing it pulls from an
ExecStartPre=-/usr/bin/podman pull -q quay.io/fedora/fedora:45 # OCI directory, hence the tag.
ExecStartPre=/bin/sh -c 'podman tag "$(podman pull -q oci:/usr/lib/runneros/job)" localhost/runneros-job'
ExecStart=/usr/bin/gitea-runner -c /etc/gitea-runner/config.yaml daemon ExecStart=/usr/bin/gitea-runner -c /etc/gitea-runner/config.yaml daemon
Restart=on-failure Restart=on-failure
RestartSec=10s RestartSec=10s
@@ -3,5 +3,5 @@
d /var/lib/gitea-runner 0700 d /var/lib/gitea-runner 0700
# The storage of root's podman is wiped at every boot, so images and leftovers # The storage of root's podman is wiped at every boot, so images and leftovers
# of jobs don't pile up. Jobs pull their images again. # of jobs don't pile up. gitea-runner.service loads the job image again.
R /var/lib/containers/storage R /var/lib/containers/storage
+22
View File
@@ -0,0 +1,22 @@
# mkosi.conf builds the job image, the container that jobs with
# runs-on: linux run in. It is an OCI image, which the OS ships in
# /usr/lib/runneros/job (ExtraTrees= in /mkosi.conf), so it is signed and
# updated with the OS. gitea-runner.service loads it into podman at boot.
#
# Packages holds what common actions need. Jobs install more with dnf.
[Output]
Format=oci
Output=job
[Content]
WithDocs=no
Packages=
dnf5 # Jobs install what else they need.
fedora-repos # dnf needs to know the repositories.
git-core # Checkouts are done with git.
nodejs26 # JavaScript actions run on node.
curl
tar # actions/cache and artifacts use these.
gzip
zstd
findutils