Forgejo Actions runner using disposable Firecracker VMs with NixOS and Ubuntu guests.
  • Rust 84.1%
  • Nix 9.4%
  • Go 4.7%
  • Shell 1.4%
  • Python 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
tsk 6437d0569d
All checks were successful
CI / check (pull_request) Successful in 10m58s
fix(forgejo): deliver workflow commands as Forgejo log rows
The engine forwarded console-formatted logs, so Forgejo received
prefixed lines such as "[job]   | ::group::title". The UI recognizes a
group marker only at the start of a row and could not collapse groups,
::debug:: output was delivered without ACTIONS_STEP_DEBUG, and each
command appeared again as an engine diagnostic.

The engine's stdout is now the Forgejo log itself, one delivered row per
line, written by the result hook the way Forgejo Runner's reporter
selects and rewrites rows. A step's rows are its output; step banners
and other engine diagnostics appear only before the first step's output
and after the last step's result. ::group:: and ::endgroup:: become
##[group] and ##[endgroup], ::debug:: rows need the ACTIONS_STEP_DEBUG
secret, and ::add-mask::, ::stop-commands:: and the resume token take
effect without a row. Dynamic masks, including %0A multiline values, are
redacted line by line like configured secrets.

Step log ranges count the rows written, after filtering and conversion,
so a step without output has length 0. The controller's delivery path
is unchanged.

Two differences from the reporter are deliberate: the engine's
diagnostic for a command is never delivered next to the command's row,
and a command written while commands are stopped is delivered as literal
text instead of being dropped.

A summary no longer produces a log row, except to report truncation in
its step's log. The new --console-log-file flag writes the console
diagnostics to a file for manual debugging; the guest agent does not
set it.

The Forgejo smokes now print nested groups, debug, stop/resume and a
multiline mask, then read the task log and step ranges back from
Forgejo's storage. Guest images must be rebuilt with this revision.

Closes #35
2026-11-12 13:53:05 +00:00
.forgejo/workflows debug 2026-10-22 19:59:30 +00:00
docs fix(forgejo): deliver workflow commands as Forgejo log rows 2026-11-12 13:53:05 +00:00
examples refactor!: rename unified-ci to Rith 2026-10-25 13:07:23 +00:00
forgejo-engine fix(forgejo): deliver workflow commands as Forgejo log rows 2026-11-12 13:53:05 +00:00
nix fix(forgejo): deliver workflow commands as Forgejo log rows 2026-11-12 13:53:05 +00:00
proto/runner/v1 feat(forgejo): deliver step summaries through UpdateStepSummary 2026-11-12 13:52:23 +00:00
src feat(forgejo): deliver step summaries through UpdateStepSummary 2026-11-12 13:52:23 +00:00
templates/custom-guest refactor!: rename unified-ci to Rith 2026-10-25 13:07:23 +00:00
tests feat(forgejo): deliver step summaries through UpdateStepSummary 2026-11-12 13:52:23 +00:00
.gitignore plan 2026-06-23 14:13:38 +01:00
build.rs feat(diagnostics): retain interrupted Forgejo attempt evidence 2026-10-23 17:26:41 +00:00
Cargo.lock build(deps): update dependencies and pin Firecracker 1.17.0 2026-11-10 23:32:49 +00:00
Cargo.toml build(deps): update dependencies and pin Firecracker 1.17.0 2026-11-10 23:32:49 +00:00
flake.lock build(deps): update dependencies and pin Firecracker 1.17.0 2026-11-10 23:32:49 +00:00
flake.nix fix(forgejo): deliver workflow commands as Forgejo log rows 2026-11-12 13:53:05 +00:00
README.md feat(forgejo): deliver step summaries through UpdateStepSummary 2026-11-12 13:52:23 +00:00
rith-compute-platform.md refactor!: rename unified-ci to Rith 2026-10-25 13:07:23 +00:00

Rith

Rith runs Forgejo Actions jobs in disposable Firecracker VMs. A controller registers with Forgejo, selects a NixOS or Ubuntu guest image by job labels, starts a fresh VM, streams logs, and reports the result. Each job gets its own writable rootfs; changes disappear when the VM is cleaned up.

The executable, Rust crate, and NixOS service are currently named rith.

Start with Setup and first CI job. It covers host storage, registration credentials, a complete NixOS deployment example, a first Nix workflow, caching, and troubleshooting.

Current scope

Rith targets x86_64 Linux hosts with systemd, KVM, and Btrfs or reflink-enabled XFS storage. Packaged guests include the pinned Forgejo v13 execution engine, Node.js, Git, and shell tools. NixOS images include Nix with flakes enabled; Ubuntu 24.04 provides its native userspace, apt, and passwordless sudo inside the disposable VM. Docker-capable images are available for both distributions.

The live Forgejo integration smoke covers private repository checkout through real checkout actions, workflow dependencies and outputs, cross-job artifact upload/download, log delivery, step summaries, and terminal status reporting. Rust and Nix checks cover controller scheduling, recovery, resource admission, and helper policy. The combined hardware smoke additionally exercises VM isolation, cancellation, restart recovery, signed Nix cache substitution, and concurrent VM I/O limits. Both NixOS and Ubuntu hardware suites passed on this workstation; see the validation report for coverage and the Ubuntu archive DNS workaround. Run the suites on each deployment host to check its storage, networking, and virtualization setup.

Compatibility follows the pinned engine and tested workflows. Service containers require an explicit job container:; host-mode services are rejected rather than silently omitted. Artifacts use Forgejo storage, and optional Actions caching uses an external Forgejo Runner cache server with repository-scoped access. Nix binary cache substitution is separate; build outputs are not automatically uploaded. Nostr/Cashu settlement is not implemented. State is durable local JSON with exclusive controller ownership, bounded history, and retry of unacknowledged results; there is no HA controller or shared multi-controller state backend.

Documentation

Development and validation

Firecracker is pinned in nix/firecracker.nix; the smoke apps and NixOS modules use this package, also available as nix build .#firecracker. The Rust overlay shares the main nixpkgs input. The Forgejo engine requires Go 1.26 or newer. Its indirect gobwas/glob and YAML v4 dependencies retain the versions supported by Forgejo runner and actionlint: their newer releases remove APIs these consumers still use. Recheck these constraints when updating the engine.

The Forgejo CI workflow runs on pushes, pull requests, and manual dispatches using the rith-nix runner. It prints the Nix version and configuration, then runs nix --debug --option build-hook "" flake check --print-build-logs --no-update-lock-file, with the checks and pinned tools defined in flake.nix and flake.lock. This builds and tests the Rust service and Go engine, runs Clippy with warnings denied, checks Rust and Nix formatting, and validates the runtime closure and NixOS configuration. The runner needs Nix with flakes enabled, Git, and Node.js for checkout, as provided by the standard Rith Nix guest. Live and hardware smoke tests remain separate commands below.

The diagnostic run temporarily disables the remote-build hook to isolate its unexpected EOF failure. Local sandboxed builds remain enabled.

Debug output is captured in a temporary guest file to avoid exhausting Rith's log budget during evaluation. On completion, CI prints the last 64 KiB; failures also print up to 64 KiB of error and build-hook context and preserve Nix's exit status. The temporary full log is removed when the step exits.

The Nix guest also sends daemon stderr to the journal and serial console, which Rith retains for failed jobs. This requires deploying a rebuilt guest image; updating the workflow alone only enables client-side diagnostics.

From the Rith checkout:

cargo fmt -- --check
cargo test --offline
cargo clippy --all-targets -- -D warnings
nix flake check
nix run .#forgejo-live-smoke
nix run .#ubuntu-guest-smoke # CPU emulation; does not verify Firecracker isolation

On a suitable KVM host, run:

sudo nix run .#firecracker-smoke
sudo nix run .#forgejo-firecracker-smoke
sudo nix run .#forgejo-ubuntu-firecracker-smoke
sudo nix run .#firecracker-egress-smoke
sudo nix run .#firecracker-command-smoke

Hardware smoke apps require root, systemd, KVM, and reflink-capable scratch storage. They return exit code 77 with SKIP when prerequisites are missing; this is not a pass. The combined test needs four available CPUs, approximately 10 GiB of available RAM, and space for two writable VM images. See the validation reference for scratch paths, overrides, and the scenarios each check covers.