A runner is a machine that runs the forge’s jobs: the checks that gate each change before it lands, the tests of main after, and release builds. Only a runner’s checks gate a landing. A runner is born from the forge when an administrator enrolls it, so it is never in the line of the person or agent whose change it tests.
Setting one up takes three steps: make its key on the machine, have an administrator enroll the key, and start it. A machine that hosts agents is another thing, an agent runner.
Make the runner’s key
On the runner’s machine, af-runner key writes a new Ed25519 private key, readable by its owner only, and prints the public key. The private key never leaves the machine. Start a development forge to follow along:
$ af-server --dev
...$ source ~/af-dev/dev/env
$ af-runner key ~/runner.key | tee ~/runner.pub
636e5f0a80d6fff5765d15bf7e99520ed9c171a88ec517f60f213a68e4f051d1Enroll it
An administrator enrolls the public key with a name for the machine. The enrollment takes effect at once, on their word, unless the forge requires a second administrator to approve it. The ID it prints is the runner’s:
$ af enroll-runner "$(cat ~/runner.pub)" --name build-01 | tee ~/runner.id
done: it took effect at once, on your word as an administrator
born 61b8d07ee35f03cce902027457be24187788fd8ecfc198631df334bb9fb04263Start it
af-runner run connects to the forge with the runner’s ID and key and runs the jobs it is given, until it is stopped:
$ af-runner run --address forge.example.com:7777 \
> --id 61b8d07ee35f03cce902027457be24187788fd8ecfc198631df334bb9fb04263 \
> --key ~/runner.key --work /var/lib/af-runner \
> --system /usr --system /bin --system /lib --system /lib64 --capacity 4
af-runner: 61b8d07ee35f03cce902027457be24187788fd8ecfc198631df334bb9fb04263 runs up to 4 jobs at onceIts options:
| Option | What it sets |
|---|---|
--address |
The forge, as host and WebSocket port. The runner connects over WebTransport where it can, and --websocket-only keeps it to WebSocket where UDP does not reach the forge. --cert-hash pins a self-signed certificate, as af --cert-hash does. |
--capacity |
How many jobs it runs at once. The forge pushes it a job whenever it holds fewer. |
--work |
Where each job’s files go while it runs. Each job has a directory of its own, removed when it ends; whatever an earlier run left there is removed when the runner starts. |
--system |
A host path a job’s program may read, at the same path, read-only: the toolchain and the libraries a build needs. Repeat it for each path. A symlink, such as /bin where it points into /usr, is seen as the same symlink. |
--env |
A variable for the programs, as NAME=value. Repeat it for each. A program sees no other variable of the runner’s. |
What a job’s program sees, and what it cannot do, is on the sandbox page.
Stop it
af-runner run stops on an interrupt or SIGTERM. It first hands its unfinished jobs back to the forge, which gives them to other runners at once. If its connection drops instead, or a node of the forge restarts, the runner connects again and goes on with the jobs it holds; they stay its own while its lease holds.
An administrator can stop a runner for good with af stop, which refuses it from then on. af-runner run exits when the forge refuses it:
$ af stop "$(sed -n 's/^born //p' ~/runner.id)" --reason "machine retired"
stop reference ad484b0dbd10c85ab5dde011db61fe3b4675c0bfc1c91c64b8a32a9dd12f5afc
stopped 61b8d07ee35f03cce902027457be24187788fd8ecfc198631df334bb9fb04263Next
- From a test to a release: one runner, end to end, on a development forge.
- The sandbox: what a job’s program sees.
- Jobs and results: how work reaches runners, and how a result becomes a record.
- Build caches: Gradle’s and sccache’s caches, served to each job.
af-runnerandaf enroll-runnerin the reference.