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>
67 lines
2.5 KiB
Markdown
67 lines
2.5 KiB
Markdown
# runneros
|
|
|
|
A VM that runs a [Gitea Actions](https://docs.gitea.com/usage/actions/overview)
|
|
runner. It is a minimal Fedora image built with
|
|
[mkosi](https://github.com/systemd/mkosi), and it builds and publishes its own
|
|
image.
|
|
|
|
- **Read-only OS:** `/usr` is read-only. Secure Boot verifies the UKI (kernel,
|
|
initrd and command line), which holds the dm-verity hash that verifies
|
|
`/usr`.
|
|
- **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.
|
|
- **Jobs in containers:** each job runs in its own privileged container on
|
|
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
|
|
repositories you trust. Container storage is wiped at every boot.
|
|
- **Self-updating:** the image rebuilds weekly. The VM lets running jobs finish
|
|
before it reboots into an update, and a bad update rolls back by itself.
|
|
|
|
## Install
|
|
|
|
Download [the disk image](https://git.plabble.org/api/packages/Job79/generic/runneros/latest/runneros.qcow2),
|
|
resize it to the disk size you want and boot it with UEFI and a TPM. At first
|
|
boot, the screen offers a recovery key for the encrypted disk and asks for a
|
|
root password. Then log in as root and register the runner with a token from
|
|
Gitea's runner settings:
|
|
|
|
```sh
|
|
gitea-runner -c /etc/gitea-runner/config.yaml register
|
|
```
|
|
|
|
It registers under the hostname, `runneros-` and four hex digits, and starts.
|
|
|
|
To start over, run `systemctl start factory-reset.target` as root. It reboots
|
|
and wipes the root partition (`/etc` and `/var`), and the VM sets itself up as
|
|
at first boot.
|
|
|
|
## Development
|
|
|
|
`mkosi build` signs with `mkosi.key`, the private key of `mkosi.crt`, which
|
|
only CI has (the `SECUREBOOT_KEY` secret). `mkosi genkey` won't replace
|
|
`mkosi.crt`, so local builds sign with a test key. Make one:
|
|
|
|
```sh
|
|
openssl req -new -x509 -newkey rsa:2048 -nodes -subj /CN=test \
|
|
-keyout ~/test.key -out ~/test.crt
|
|
```
|
|
|
|
and point `mkosi.local.conf` at it, which mkosi reads and git ignores:
|
|
|
|
```ini
|
|
[Validation]
|
|
SecureBootKey=~/test.key
|
|
SecureBootCertificate=~/test.crt
|
|
SignExpectedPcrKey=~/test.key
|
|
SignExpectedPcrCertificate=~/test.crt
|
|
VerityKey=~/test.key
|
|
VerityCertificate=~/test.crt
|
|
```
|
|
|
|
Then run `mkosi build`.
|
|
|
|
`mkosi.output/` then holds the disk image (`runneros_<version>.raw`) and the
|
|
UKI and /usr partitions that make up an update. To boot a test VM, see
|
|
[AGENTS.md](AGENTS.md#testing).
|