Skip to content

Jobs and results

The forge pushes jobs to runners over their open connections, a runner holds them by a lease it renews with heartbeats, and each result is signed and becomes part of the record.

A runner never polls for work. It tells the forge how many jobs it can run at once, and the forge pushes it the job that has waited longest whenever it holds fewer, over the runner’s open connection, as Buildbarn schedules its workers.

What a job is

Job When Program Result
A check A change is submitted and main holds .forge/test; again each time it is submitted main’s .forge/test on the change’s commit Passed or failed, which lets the change land or opens it again
A test of main Continuously after landings, and to bisect and confirm a failure That landing’s own .forge/test Passed or failed, which may revert a landing; or skipped when its files hold contents purged
A release’s build A release is requested main’s .forge/release on the release’s commit The files it writes under /work/out, the release’s artifacts

For each job, the runner checks out the commit’s files and main’s .forge/ folder into a directory of that run’s own, runs the program in the sandbox, counts the tests it reported, reports the result, and removes the directory.

If the forge withholds any of those files, because their contents were purged after the job was queued, the runner runs nothing. It names each withheld path in its output and reports the job skipped. The forge checks the claim against its own records and refuses one that does not hold. What happens next depends on the job:

  • A test of main is skipped.
  • A release’s build fails, with the reason.
  • A change’s check whose own commit is whole runs again with main’s .forge/ as main stands now.

Results

A check’s result is in-toto’s own test-result statement: the commit checked, PASSED or FAILED, and which .forge/test ran, and in a field of the forge’s own, tests, what the runner counted: the suites, the tests listed, passed, failed, skipped, missing and flaky, those reported but not listed, and a digest of every outcome; or why the reports could not be counted. A test passes only if the program exited 0, every listed test has a result and none failed. The forge gives jobs only to a runner that counts tests. The runner signs it, and the forge signs it again once it accepts it. The forge accepts a result only from a live runner, for a job assigned to it and not yet done, of exactly that job’s commit and .forge/. A pass of exactly the commit submitted meets the landing’s check, and the signed result becomes part of the landing’s record.

A release’s build is recorded the same way, as a “release built” record naming the release, the commit and each artifact’s SHA-256, which the forge reads from the files themselves. A person then approves that exact build, and the forge publishes it with its SLSA provenance.

Leases

A runner holds its jobs by a lease, as Nomad’s clients hold their allocations. Assigning a job starts a timer for the runner, and each of its heartbeats resets it. The forge tells the runner how often to heartbeat:

Setting Default af-server option
The shortest heartbeat interval 10 seconds --min-heartbeat-ttl
The most heartbeats a repository’s leader takes a second 50; longer intervals are given to stay under it --max-heartbeats-per-second
Extra time before a silent runner’s jobs go to another 10 seconds --heartbeat-grace
The interval after another node takes over a repository 5 minutes, for runners to find the new leader --failover-heartbeat-ttl

These are Nomad’s own defaults. A runner whose lease runs out is marked down, and its jobs go back in the queue for other runners in the same write. It is given no job until it heartbeats again. Heartbeats are never written to the log: only a lease that runs out is.

Connections that drop

A dropped connection gives nothing back. The runner’s jobs stay its own while its lease holds, and it connects again, once a second, while the forge cannot be reached. The forge first tells it every job it holds, and the runner carries on with those it was running and starts the rest. A job whose files it could not all fetch runs again. A result it could not report is reported again, never run again.

A runner that stops on purpose, on an interrupt or SIGTERM, hands its jobs back at once, as Nomad drains a node. It is marked down in the same write, so a connection of its that the forge has not yet seen close takes none of them back.

Not yet

  • Placement by cache. Jobs go to whichever runner has room, not to one whose cache already holds the build’s outputs.
  • Re-runs on another runner, to catch flaky tests and dishonest runners, and what to do when they disagree.
  • Keeping a run’s output. A check’s result and its counts are kept; what the program printed, and which tests failed, stay in the runner’s own output.

Next

Type to search…

↑↓ navigate↵ selectEsc close