---
title: "From a test to a release"
description: "One runner on a development forge, end to end: the test program lands, a change lands once the runner's check of it passes, a broken one is sent back, and a release is built, approved, published and verified."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.forge.workreef.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# From a test to a release

This page runs everything a runner does, with one runner on one development forge: the test program lands, a change lands once the runner's check of exactly its commit passes, a broken change is sent back, and a release is built, approved, published and verified. Every command runs as shown when the book is built.

## A forge and a runner

Start a development forge, and enroll a runner's key, as [Set up a runner](https://docs.forge.workreef.dev/runner/setup/) explains:

```console server
$ af-server --dev
...
```

```console check
$ source ~/af-dev/dev/env
$ af-runner key ~/runner.key > ~/runner.pub
$ 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 8817fd4e91d9fd38e722f03bc372a0e12d7fe2cb02e7eb2f5cde987816eeeb03
```

Start the runner. It runs until it is stopped, so it goes in a terminal of its own. Once it says how many jobs it takes, the forge pushes it work:

```console background
$ af-runner run --address "$AF_ADDRESS" --cert-hash "$AF_CERT_HASH" \
>     --id "$(sed -n 's/^born //p' ~/runner.id)" --key ~/runner.key --work ~/runner-work \
>     --system /usr --system /bin --system /lib --system /lib64 --capacity 1
af-runner: 8817fd4e91d9fd38e722f03bc372a0e12d7fe2cb02e7eb2f5cde987816eeeb03 runs up to 1 job at once
```

## The test program lands

Until `main` holds a test program there is nothing to check. Make a workspace, and a change that adds one, `.forge/test`: it checks the syntax of each shell script a change touches, one test a script, and [reports each](https://docs.forge.workreef.dev/concepts/testing/#every-test-accounted-for) in TAP, its plan first.

```console check
$ af workspace add ~/repo > /dev/null
$ cd ~/repo
$ af new -m "Check shell scripts"
Working on change qzvkpwzmzywmtpmuoklyzzplvznkyopm at commit 9731be11846f99781c27c58c67f4f52405351ae88f2f1d58d04b9486bbe38aaa
$ mkdir -p .forge
$ cat > .forge/test <<'EOF'
> #!/bin/sh
> set -eu
> mkdir -p "$FORGE_OUT/tests"
> printf 'syntax tap\nend\n' > "$FORGE_OUT/tests/inventory"
> report="$FORGE_OUT/tests/syntax.tap"
> grep '\.sh$' "$FORGE_CHANGED" > "$FORGE_OUT/scripts" || true
> echo "1..$(grep -c . "$FORGE_OUT/scripts" || true)" > "$report"
> status=0
> while read -r path; do
>   # A `#` in a test's name is escaped, or it would start a directive.
>   name=$(printf '%s' "$path" | sed 's/\\/\\\\/g; s/#/\\#/g')
>   if [ ! -f "$path" ] || sh -n "$path"; then
>     echo "ok - $name" >> "$report"
>   else
>     echo "not ok - $name" >> "$report"
>     status=1
>   fi
> done < "$FORGE_OUT/scripts"
> exit "$status"
> EOF
$ chmod +x .forge/test
$ af submit
Submitted commit c40dc76dbc7047bb38b3e1379005d4c4fbeb4622e4280d598e86e064e5481ab6, 1 edit in its last snapshot
```

A change to `.forge/` waits for a person's approval, so the script that judges changes is never edited without one. The development forge's first administrator does not hold approver; grant it, and approve the change:

```console check
$ af grant dev@localhost approver --reason "end to end"
done: it took effect at once, on your word as an administrator
$ af approve-change @
approved commit c40dc76dbc7047bb38b3e1379005d4c4fbeb4622e4280d598e86e064e5481ab6 of change qzvkpwzmzywmtpmuoklyzzplvznkyopm
```

```console eventually
$ af status
Change qzvkpwzmzywmtpmuoklyzzplvznkyopm (landed) at commit c40dc76dbc7047bb38b3e1379005d4c4fbeb4622e4280d598e86e064e5481ab6
```

## A change lands once its check passes

From now on, every submitted change waits for the runner's check of exactly its commit, run with `main`'s `.forge/test`. The change's own code runs in that check, so a pass shows it broke nothing the script catches by mistake, not that it did not cheat on purpose. A change that adds a sound script passes, and lands:

```console check
$ af new -m "Add a build script"
Working on change yvsnvntlunyrpqzqkvstylrytozokqrq at commit 38cb9ffec00fa6fdfe474c19acac27f067a9e366fa65e8d6ce18d914d7b91cf0
$ printf '#!/bin/sh\necho building\n' > build.sh
$ af submit
Submitted commit 417b4b381c8babb31e814520d7291be499ba8879992931331de2dd91e931e1bb, 1 edit in its last snapshot
```

```console eventually
$ af status
Change yvsnvntlunyrpqzqkvstylrytozokqrq (landed) at commit 417b4b381c8babb31e814520d7291be499ba8879992931331de2dd91e931e1bb
Based on landing 1
```

## A broken change is sent back

A change that breaks the script fails its check. The forge opens it again instead of landing it, and it waits for a check of a new commit:

```console check
$ af new -m "Break the build script"
Working on change lzurqosywumonkoooxmyomuqunzmuqou at commit 768a190cd73f4110a21738e392a2351aaea81196ebb3d1325aa860c30ce02769
$ printf '#!/bin/sh\nif then\n' > build.sh
$ af submit
Submitted commit 711c7b3edce1c4e357148da6edba99d7eccd44e227db034349383efe1a131aad, 1 edit in its last snapshot
```

```console eventually
$ af status
Change lzurqosywumonkoooxmyomuqunzmuqou (open) at commit 711c7b3edce1c4e357148da6edba99d7eccd44e227db034349383efe1a131aad
Based on landing 2
Landing waits for: checks
```

`main` never held the broken script. Fixing it and submitting again would run a new check.

## A release

Abandon the broken change, and land a release program. Like the test program, it is `main`'s, under `.forge/`, and what it writes under `$FORGE_OUT` is the release:

```console check
$ af abandon
Abandoned change lzurqosywumonkoooxmyomuqunzmuqou
$ af new -m "Build a release"
Working on change wsmomwvuuslyxksqtkszpyqrrkvmklpv at commit 1782882e329e2b7d0a687d16d2bbdb7721a0464bfcc18de8dc7d58060f0dfe50
$ printf '#!/bin/sh\nset -eu\nprintf "hello from %%s\\n" "$FORGE_COMMIT" > "$FORGE_OUT/hello.txt"\n' > .forge/release
$ chmod +x .forge/release
$ af submit
Submitted commit 6a767659a6e41b20fe77efac440a01ee8fda3106dc9e7478f3ac06ae920021cb, 1 edit in its last snapshot
$ af approve-change @
approved commit 6a767659a6e41b20fe77efac440a01ee8fda3106dc9e7478f3ac06ae920021cb of change wsmomwvuuslyxksqtkszpyqrrkvmklpv
```

```console eventually
$ af status
Change wsmomwvuuslyxksqtkszpyqrrkvmklpv (landed) at commit 6a767659a6e41b20fe77efac440a01ee8fda3106dc9e7478f3ac06ae920021cb
Based on landing 2
```

Ask for a release of `main` as it is. The runner builds it in its sandbox, and the forge hashes each artifact itself, from the bytes it was sent:

```console check
$ af release request v1.0
v1.0 requested 6a767659a6e41b20fe77efac440a01ee8fda3106dc9e7478f3ac06ae920021cb
```

```console eventually
$ af release show v1.0
v1.0 built 6a767659a6e41b20fe77efac440a01ee8fda3106dc9e7478f3ac06ae920021cb
  b90c7e48b8cd80f5ec4c9718309382f63d8b566674a468c7387a25ef84dc8dc1 76 hello.txt
```

Each artifact is listed with its SHA-256 and its size.

A person approves exactly that build, and the forge publishes it: the approval and the provenance, SLSA's build provenance signed by the organization's receipts key, go into the repository's log together:

```console check
$ af release approve v1.0
v1.0 published 6a767659a6e41b20fe77efac440a01ee8fda3106dc9e7478f3ac06ae920021cb
  b90c7e48b8cd80f5ec4c9718309382f63d8b566674a468c7387a25ef84dc8dc1 76 hello.txt
provenance: entry 22 of the repository's log
```

By default the asker's own person may approve their release. Every compliance report then lists it as an exception, and a forge that requires another person refuses it.

Anyone may fetch an artifact and check it against the provenance, with the organization's key and the log alone:

```console check
$ af release get v1.0 hello.txt -o ~/hello.txt
$ cat ~/hello.txt
hello from 6a767659a6e41b20fe77efac440a01ee8fda3106dc9e7478f3ac06ae920021cb
$ af release verify v1.0 hello.txt ~/hello.txt
pinned the receipt log of main at 127.0.0.1:7777: localhost/atoll-forge/operator/main
verified v1.0 hello.txt b90c7e48b8cd80f5ec4c9718309382f63d8b566674a468c7387a25ef84dc8dc1: provenance at entry 22 of the repository's log, witnesses 0 of 0
```

The first verification pins the log's origin and keys, as SSH pins a host's key, and later ones check against them. It waits for the log's next checkpoint to cover the provenance, a moment after publication. Witnesses are other parties that cosign the log's checkpoints; a development forge has none.

## Next

- [Jobs and results](https://docs.forge.workreef.dev/runner/jobs/): how work reaches runners, and how a result becomes a record.
- [Search, caches and releases](https://docs.forge.workreef.dev/concepts/search-caches-releases/): SLSA Build Level 3, and why no outside service signs.
- [`af release`](https://docs.forge.workreef.dev/reference/af/release/) in the reference.

Source: https://docs.forge.workreef.dev/runner/end-to-end/index.mdx
