---
title: "Run CI on runners you own"
url: https://docs.loot.build/guides/runners
group: "Guides"
status: written
summary: "A tracked .lootpipeline, a runner that is its own key, and verdicts a land can require."
---

# Run CI on runners you own

> A tracked .lootpipeline, a runner that is its own key, and verdicts a land can require.

A repo’s CI is a tracked file, `.lootpipeline`, and runners you own run it. The forge queues jobs and keeps verdicts; it runs nothing. A runner is a key of its own that signs a pass, and a land counts that pass only from a key this repo trusts.

## Declare the steps

One step a line: `<name> <trigger> <kind> <what>`. The trigger names the tree a step judges: `change` is any version that might land, `main` the landed tip. A `check` step runs one of loot’s own text checks in-process (`line-ending`, `runbook-portability`, `doc-link`). A `run` step is a program and its arguments, with no shell. `require <step>` makes a land of someone else’s work refuse until a trusted runner has passed that `change` step; with no `require` line, verdicts only advise. `#` starts a comment.

```bash
cat > .lootpipeline <<'EOF'
# CI for this repo: <name> <trigger> <kind> <what>
lint change check line-ending
links main check doc-link
test change run cargo test --workspace
require lint
EOF
loot pipeline list         # the steps it declares; a line that is not a step refuses
loot pipeline run --on main
loot pipeline run --only lint
```

`loot pipeline run` judges the working tree (the `change` steps unless `--on main`), and `--version <id>` judges a version you hold, by its own `.lootpipeline`, in a scratch tree. It exits 0 when every step cleared, 2 when one failed, 1 when one could not run. The file never runs on its own, since anyone who can push could write it: a pull runs nothing, and only your own `.loot/gates` line, which no pull writes, makes a local land run it.

## Enrol a runner

From a repo whose remote is a forge, as its owner. `--can` names the kinds it may claim, and `--paths` narrows what it may read, which always includes `.lootpipeline`. A `run` step that needs one operating system names it in its kind, `run@linux`, `run@windows` or `run@macos`: only a runner enrolled for that kind takes it, and a runner refuses to start with another platform’s kind.

```bash
loot runner add --name ci-1 --can check,run
# it prints the home file it wrote under .loot/runner-homes/, which holds
# the runner's PRIVATE key: copy it to the runner's machine (here ci-1.env),
# then delete this copy
loot runners            # name, key, kinds, and when the forge last heard from each
```

The home file holds `LOOT_RUNNER_FORGE`, `NAME`, `CAN`, `PUBKEY` and `KEY`, so it mounts as a file or as environment. To keep the private key from ever leaving the runner’s machine, mint it there instead and enrol only its public half:

```bash
# on the runner's machine, in any directory; <repo-url> is the repo's
# forge address, as loot remote list prints it
loot keygen --home ci-1.env <repo-url> --name ci-1 --can check,run
# it prints the public key; then in the repo, as its owner:
loot runner add --name ci-1 --can check,run --pubkey <public-key>
```

`keygen --home` writes the same home file, readable by you alone, refuses a file that already exists, and prints only the public key, so nothing secret crosses between the machines. `--wake-url` names an https address the forge pings when a job waits; without one the runner polls. The runner’s key goes into `.loot/runners`, which is per machine: a land elsewhere refuses its pass as an untrusted signer until that machine trusts it too.

Before it registers anything, `runner add` says how many paths the scope reaches and names any Restricted ones. A scope that reaches a Restricted path is refused with `restricted_scope` and nothing is registered: narrow `--paths` to leave those paths out, or pass `--allow-restricted` if you mean to give the runner their keys. A `--paths` entry that reaches no path draws a warning.

Runners come with a paid plan. On a plan without pipelines, `runner add` refuses with `over_plan`, as it does past the plan’s cap of live runners a repo. `loot runner retire --name ci-1` retires one for good and frees its place; its past passes stay trusted.

## Run it

On the runner’s machine, outside any repo. `loot runner once` claims one job, fetches the one version it names, checks that the tree is the one its id and author signature say, runs the steps in a scratch tree and posts the verdict. `loot runner serve` does that until stopped.

```bash
loot runner once --home ci-1.env
loot runner serve --home ci-1.env --trust members --poll 30
```

`--trust` bounds whose work it runs: `landed` runs only `main`; `members`, the default, adds proposals by the repo’s members and those the owner approved to run (an approval never lets one land); `anyone` runs every proposal. `--logs local` keeps step output on the runner; by default each step’s tail is posted sealed, so only the repo’s key holders read it. Run `serve` under whatever keeps a process up, such as a systemd unit or a launchd agent, with `Restart=always` or `KeepAlive`.

## Read the verdicts

In the repo, as its owner:

```bash
loot pipeline status     # the passes trusted keys signed on HEAD
```

A pass is a signature the runner posts to the forge. `loot pipeline status` asks the repo’s remote for the passes on that version, checks each signature here, keeps those from keys this repo trusts, and lists them; with no remote, or one that does not answer, it lists what the repo already holds and says so. Name a version to read another than `HEAD`. A runner signs passes only; a failure is a job row at the forge, and `loot account inbox` reports each finished job, failed or not. All of these take `--json`.
