Lands Forgejo pull requests, next to Forgejo on the home cluster (RLMQ-1)
  • Go 98.2%
  • PowerShell 1.4%
  • Dockerfile 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nelson 77a0b585c4
All checks were successful
Suite cluster-service / scope (push) Successful in 5s
Suite cluster-service / publish (push) Has been skipped
Suite cluster-service / check-manifests (push) Has been skipped
Suite cluster-service / check-image (push) Has been skipped
Suite cluster-service / check-smoke (push) Has been skipped
Suite cluster-service / reused-checks (push) Has been skipped
Pin forgejo.romaine.life/romaine-life/merge-queue v0.1.27 (#63)
2026-12-01 05:21:56 -08:00
k8s Pin forgejo.romaine.life/romaine-life/merge-queue v0.1.27 (#63) 2026-12-01 05:21:56 -08:00
testdata Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
.gitignore merge-queue reads only what a delivery says changed (#16) 2026-11-18 20:13:52 -08:00
.npmrc Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
batch.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
batch_test.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
configure.ps1 configure.ps1 comment points at romaine-life/homesvc (#36) 2026-11-29 21:04:05 -08:00
decide.go Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
decide_test.go Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
Dockerfile Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
fake_test.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
forgejo.go Landings write a landed library's users' bumps onto main in dependency order (MQ-8) (#46) 2026-12-01 00:44:04 -08:00
go.mod Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
go.sum Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
goproxy.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
goproxy_test.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
graph.go Test a library change with every module downstream of it before it lands (MQ-7) (#44) 2026-11-30 23:15:50 -08:00
groups.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
groups_test.go Lines across repositories: each pull request tested as if those ahead had landed (MQ-10) (#50) 2026-12-01 03:04:18 -08:00
keep.go A restart's landings wait for every repository's topics, so a landing waiting on its release still bumps its users (MQ-8) (#57) 2026-12-01 04:04:02 -08:00
landing.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
landing_test.go A restart's landings wait for every repository's topics, so a landing waiting on its release still bumps its users (MQ-8) (#57) 2026-12-01 04:04:02 -08:00
landingview.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
lines.go Lines across repositories: each pull request tested as if those ahead had landed (MQ-10) (#50) 2026-12-01 03:04:18 -08:00
lines_test.go Lines across repositories: each pull request tested as if those ahead had landed (MQ-10) (#50) 2026-12-01 03:04:18 -08:00
main.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
main_test.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
mergeup_test.go Merge up a Go PR whose go.mod or go.sum conflicts with main instead of stopping it (#27) 2026-11-28 17:35:32 -08:00
metrics.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
mirror.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
mirror_test.go Lines across repositories: each pull request tested as if those ahead had landed (MQ-10) (#50) 2026-12-01 03:04:18 -08:00
model.go Lines across repositories: each pull request tested as if those ahead had landed (MQ-10) (#50) 2026-12-01 03:04:18 -08:00
prepare.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
prepare_test.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
queue.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
README.md Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00
reads_test.go An updated front is judged on its new head, not the old one's late runs (MQ-4) (#29) 2026-11-29 09:50:07 -08:00
releasetag.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
releasetag_test.go Prepared landings: a library change's landing is planned when its group test starts, its releases prebuilt, its planned bumps pushed (MQ-11 step 5b) (#56) 2026-12-01 04:17:32 -08:00
runner.go Log failed clones and a summary once the clones are warm (RLMQ-6) (#42) 2026-11-30 22:51:18 -08:00
selftest.go Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
shadow.go Shadow mode finds a reused check among every status on the head (MQ-12) (#60) 2026-12-01 04:31:59 -08:00
shadow_test.go Shadow mode finds a reused check among every status on the head (MQ-12) (#60) 2026-12-01 04:31:59 -08:00
store.go Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
store_test.go Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) (#54) 2026-12-01 03:42:14 -08:00
webhook.go Batched delivery: a landing's apps are held as drafts and delivered together in one deliver.yml run (MQ-11 step 5c) (#62) 2026-12-01 05:21:15 -08:00

merge-queue

Lands pull requests on https://forgejo.romaine.life. A pull request carrying the queue label is brought up to date with its base and squash-merged once its own CI passes on that head, one per line at a time: a line is a repository's queued pull requests, joined across repositories where a library change reaches them (Lines, below). It runs on the home cluster beside Forgejo, acts on Forgejo's webhooks, and replaces strip-owner's landing (romaine-life/agent-tools). Design: https://openproject.romaine.life/wp/RLMQ-1.

What it holds

The queue holds nothing durable. Its state is Forgejo's: the label, the label's timeline, and a commit status with the context merge-queue on each queued pull request's head. A restart reads Forgejo again, so there is nothing to back up. Shadow mode's record (below) is DATA_DIR/anvil.db, SQLite: losing it loses only what it has compared so far.

On its volume (DATA_DIR) it keeps a clone of every live repository of its owners (RLMQ-6): bare and blobless, holding every branch's and pull request's commits and trees, and fetching a file's contents the first time something reads it. At startup it lists the repositories (Forgejo's search, archived ones, mirrors and empty ones aside), clones those with no clone and fetches the rest; after that a push to one fetches it. A clone is made beside its place and moved in once whole. One that fails is tried again whenever any other fetch succeeds, since Forgejo answers again. Losing the volume costs one startup's clone of everything.

From the clones it reads the module graph: every go.mod on each repository's default branch (outside the folders Go never builds) and the modules each requires, read again at each fetch. A module path resolves to the repository it names, so a copy of a module's go.mod elsewhere provides nothing. A library's group is it and every module downstream of it at any depth, nearest first; each repository whose go.mod files couldn't be read, or whose clone isn't ready, is named unread, since it could be downstream.

In memory it keeps what its last look read of each repository: the repository, its queued pull requests, each one's label time and the statuses on its head, and which heads were up to date with their base (FORGEJO-56). A delivery marks what it says changed, and the next look reads only that (see Events, no timers). A look that stops on an error drops what it kept of that repository, so the next reads it whole. Each look also leaves its repository's queued pull requests in line as it found them, which every other repository's look reads to find its lines (Lines, below).

  • main.go: configuration, the HTTP server (/webhook, /health, /metrics) and the startup read.
  • webhook.go: checks each delivery's signature and, when it touches the queue, asks for a look at its repository.
  • model.go: what the queue keeps between looks, and what each delivery marks changed.
  • runner.go: one look per repository at a time; requests made during a look become exactly one more look after it. Repositories don't wait on each other.
  • queue.go: the look itself (below).
  • forgejo.go: the Forgejo API client.
  • metrics.go: the Prometheus counters.
  • mirror.go: the clones.
  • graph.go: the module graph and groups.
  • keep.go: the clones' startup, their pages and gauges.
  • groups.go: group tests of library changes.
  • lines.go: lines across repositories, and what each tests as if those ahead had landed.
  • landing.go: landings, which write a landed library's users' bumps.
  • landingview.go: what the lines read of the landings not done.
  • goproxy.go: the module proxy and its self-check.
  • decide.go, shadow.go, store.go: shadow mode, its decisions and comparisons, and their database (Shadow mode, below).
  • prepare.go: prepared landings, their plans and prebuilds.
  • batch.go: batched delivery, a landing's apps delivered together.
  • releasetag.go: the release suite's tag numbering, which a plan predicts with.

How it decides

Joining. An open pull request with the queue label is queued. Its place is when the label was last added, read from its timeline, with ties going to the lower number; the one exception is the front whose CI is running (below). One into a branch other than the repository's default, or a draft, gets a failure status saying so and is looked at again when that changes.

The status. The queue writes its merge-queue status only when it would change: pending says where the pull request is ("1st in line, waiting for CI", "3rd in line, behind #41: its title", linking #41; "1st in line in owner/repo, behind owner/other#7 in its line: its title", linking that one, for a repository's front waiting on another repository's pull request; so the line can be followed to its front), failure says why it stopped (CI failed and which checks; conflicts with the base; Forgejo refused the update or the merge, with Forgejo's message), and success says it landed or left the queue. The queue's own status never counts as CI. Writing a failure, it also comments on the pull request with the reason: Forgejo sends no event for a commit status but does for a comment, so whoever follows the pull request (strip-owner, through ntfy's pr-events) hears at once why it stopped.

Stepping aside. A failure newer than the latest addition of the label takes the pull request out of line, so one failure doesn't hold up the rest. A push makes a new head, which has no failure. Removing the label and adding it again makes the failure older than the addition, so the pull request is looked at again with no push: a refused merge whose cause was fixed elsewhere lands this way (RLAHT-3). A CI failure also clears when a re-run passes on the same head, and one handed back this way whose base has moved since stays in line, so at the front it is brought up to date and CI runs on the new head: a failure fixed on the base lands with no push (RLMQ-2). Handed back with its base unmoved, it steps aside again: the queue never runs CI again on the same head, since a failure that passes on a retry is a flaky test or a fault on the CI PC, which is fixed, not retried (MQ-4). Its stop comment says to push a fix.

The front. Per repository, the earliest queued pull request not stepped aside; it acts (below) only once it is also the front of its line, and until then waits with the status that names the pull request ahead of it in another repository (Lines). Once at the front it stays there until it lands or steps aside, so its running CI is never thrown away: one handed back by a push, or by a rerun someone else started that passed, goes ahead of every pull request still waiting, not ahead of the front (MQ-4). The queue holds which it is, and after a restart finds it by its own status, a "1st in line" or "merging in" written since its label was last added; a restart during a Go merge-up, whose push leaves a head with no status, falls back to label order. Handed over again with pull-request ready, which removes and adds the label, the front joins at the back like any other.

  1. Behind its base: the branch is updated (a merge of the base into it), and CI runs on the new head. The queue reads that head at once and writes its front status there, so the old head's runs, which can still report (one the update superseded as a failure), are never judged (MQ-4). Refused for conflict, it steps aside, except in a Go repository (its ci-go topic), where it is merged up (below) and stays at the front meanwhile.
  2. CI running: it waits. While a check the base's protection requires has no status yet, matched as Forgejo matches it (a glob over the status contexts), it waits for CI to start: updating a branch also starts its push-triggered suites, whose skipped jobs report before the pull request's own checks exist (MQ-1). With no CI reported at all, and workflows in the head or the base or a ci- topic on the repository (its CI comes from pipeline-templates' suites, RLMQ-3), it waits for CI to start too.
  3. Up to date and green (every other status success, skipped or warning): squash-merged, pinned to the head it judged, branch deleted. One from a github/ branch, which repo-sync opens with the work machines' GitHub commits (shell-config-profile-home k8s/sync-to-forgejo, HOMECFG-248), lands with a merge commit instead, so those commits stay in the base's history and GitHub's branch fast-forwards to it. A refusal on a pull request that merged some other way, or whose head moved meanwhile, is no failure. Refused while Forgejo is still checking the head, it waits for that check. Any other refusal steps it aside.

The rest are only checked for failed CI; they are never updated.

Conflicts. Forgejo's API reports mergeable: false while it is still checking a new head, so that field is never read. A conflict is known only from an update or merge refused for it, or from the pull_request webhook with action mergeable_checked, which our Forgejo build sends when its conflict check of a head ends (nelsong6/forgejo). false steps the pull request aside, except in a Go repository, where it stays in line until the front merges it up; true brings back one that stepped aside for a conflict.

Merging up a Go pull request (MQ-3). A pull request that moves a module's version itself, and the bump a landing writes onto main (below), change the same go.mod and go.sum lines, so the pull request conflicts once the bump lands. At the front, a Go repository's conflict dispatches pipeline-templates' go/dependencies.yml on the default branch with the pull request's number and head (pr, head), and the status says pending "merging in main, settling go.mod and go.sum". The job merges the base into the branch, keeping each module at the newer of the two versions, and pushes the merge (pipeline-templates suites/go/conflicts.mjs), a new head the queue goes on with as after an update. What it can't settle, a conflict in another file or in go.mod's other directives, it writes to the head as a failed go.mod merge status, never counted as CI; the queue then steps the pull request aside with "conflicts with main: " and the job's reason, linking its run. A dispatch Forgejo refuses steps it aside with Forgejo's message. A front whose merge-up runs is acting: it doesn't wait behind another repository's pull request in its line until the merge-up's push gives it a new head, so its status keeps saying it merges in, which a restart reads; the queue also holds which head it dispatched a merge-up for, since the label was last added. Adding the label again merges it up again.

Group tests (RLMQ-6). A pull request that changes a Go library other modules use is tested with all of them before it lands. The queue reads the files it changes from the clone (fetching the head first if the push's fetch hasn't come yet), once per head and base. A changed file that can change what users compile (not a _test.go, a .md or anything under testdata) belongs to the module whose folder is deepest above it; each such module with users, provided by the pull request's own repository, is a library of the change. The queue dispatches pipeline-templates' go/group.yml on the tested pull request's branch with pr and group: {"version":2,"repo","sha","libraries":[{"repo","sha","module","dir"}],"members":[{"repo","sha","topics","modules":[{"path","dir"}]}]}, the tested pull request's repository and head, the library modules with each one's repository and commit, and every module downstream of them with its repository's commit and topics (which commits, Lines says); at the front of its line the status says "1st in line, testing it with the N modules that use it". Forgejo posts no commit status for a dispatched run, so the queue reports it on the head itself, in the context merge-queue / group: pending linking the run as soon as it starts, then, at the first look after the run ends (its run events bring one), success, or failure for a run that failed or ended without a result (cancelled). Each of these ends with its test's key, [k:xxxxxxxx]: the first eight hex digits of a SHA-256 over each repository the input names and the tree of the commit it takes there, so the same trees are the same test whichever commits carry them. A test whose key isn't the one its pull request's input has now is no result for it: the queue dispatches it again, and the newer run cancels the older (the workflow's concurrency, one run per pull request). That status is the whole record, so a restart finds the run and what it tested from it; a restart between the dispatch and the status starts another run, which cancels the first. A failed test at the front of a line steps the pull request aside as failed CI. Once the lines have settled after a restart, a group status counts (failed, pending or passed) only while its key is the pull request's current one: a pull request aside for a failed test stays aside, with no write, while its current test is that one, never the same test twice (MQ-4); when what it would test changes (another key) it is back in line and tested again, and one its line no longer tests (the library ahead of it left, or its change no longer touches a library) ignores its group status and lands on its own CI, its status saying nothing of the group. The stale group status stays on its head as written. While any repository's clone isn't ready the group isn't known whole: no test starts, and the front waits, naming it; a fetch once the clones are warm looks again. A dispatch Forgejo refuses steps the pull request aside with Forgejo's message.

Lines (MQ-10). A queued pull request affects its repository and, when it changes a library with users, every repository of that library's group. Across every repository, queued pull requests (not stepped aside, drafts or into another branch) whose affected repositories overlap share a line, transitively; an app change nothing imports keeps its own repository's line, decided exactly as before. Within a line the order is a repository's front whose CI is running first (as within a repository, MQ-4), then label time, then repository, then number. A pull request acts as a front (updated, merged up, tested at the front, landed) only when it is its repository's front and no pull request of another repository is ahead of it in its line; a repository's front with one ahead waits, its status naming and linking the nearest one ahead.

Every pull request in a line that changes a library, or that is behind a library change whose group holds its repository (in a repository on the go suite, which the group job comes from), is tested at once, not only at the front, as if the pull requests ahead of it had landed. What a test takes as ahead of it is the pull requests ahead of it by label time (and the landings in progress that reach it), the same whether it is in line or aside: a front whose CI runs that went ahead of it, labelled later, waits ahead of it but isn't in its test, so its test doesn't change with who is acting, and a failed test stays its current one until something it holds changes. The test takes its own library modules at its head, then those of the pull requests ahead at theirs; every module downstream of any of them; its own repository at its head (as a library's or a member's), every other repository at the head of the nearest pull request ahead of it there, else at its default branch's commit. One commit stands for each repository, so where a repository has several pull requests ahead, the nearest one's head is taken, and only its library changes: each head holds those before it in its repository only once its front brings it up to date, and its key then changes. The run goes in the tested pull request's repository, on its branch. Its run's state is read when an event on its head brings a look; a look another repository asked for reads nothing more of it.

Tests are bounded by a window (Zuul's), LINE_WINDOW, 3 unless set: counting from the front of a line, only the first that many pull requests the line tests have their tests started, so a library with many users doesn't start a group job for every pull request behind it, and again for each on every change. One beyond the window still waits as before, its status saying "5th in its line; tested once it is within 3 of the front" (its place in the whole line, linking the pull request ahead as its place status would), and nothing is dispatched for it, whatever its key does. When one ahead lands or leaves, the look that follows (the same look in its own repository, the look it asks for in the others) starts the test of the pull request that comes within the window.

A test that fails while a pull request ahead of it in that test hasn't passed (its own CI and, where it is tested, its current-key group test) is held: its failure may be the one ahead's, and nothing is dispatched for it meanwhile. Once every one ahead in it has passed, the failure is its own and it steps aside; a pull request ahead that fails steps aside in turn, and every test behind it that took its head gets an input without it, a new key, and runs again. Only the front of a line lands, once its own CI and its current-key group test pass. A pull request that lands by a squash merge of an up-to-date head leaves a default branch with the tree its head had, so the tests behind it keep their keys; the queue fetches that repository's clone at once after such a landing, so the next look reads the merge. A group status is replaced only by a new test's pending: one on a head nothing tests any more stays as it was written.

A library change that landed hasn't reached its users' default branches until its landing writes their bumps (Landings), so a landing not done stands in the lines, first, ahead of every queued pull request in a user repository its bump hasn't been written to yet, with its libraries at the merge commit. Such a pull request keeps waiting behind it, its status naming the landing, saying what it waits for (its waits in GET /landings: "1st in line in owner/user, behind owner/lib#7's landing, which waits for the release run of owner/lib at abc1234") and linking its pull request, or its commit; it stays tested with it: a squash merge leaves the library's tree as the pull request's head had it, so the test it had stands. A repository the landing stops holding gets a look then: its bump pushed (released only once the push is made, never before: a look then could land a pull request on its own CI ahead of the bump it was tested with; a push's delivery that comes first finds it still held), unchanged, skipped or failed, or the landing done, since a bump that pushes nothing brings none; so does each repository it holds when what it waits for changes. Once that repository's bump is pushed, the pull request is behind its base and the front brings it up to date as usual. A library change the queue lands stands in its line from the moment it lands until the landings have read the merge, which they are asked to do then, whether or not other repositories' pull requests were queued; it holds every user repository of the library, pull requests labelled after the merge included. Its repository's clone is fetched at once; a fetch that fails ends the look in an error (the next event looks again), the merge taken from Forgejo meanwhile.

Each look publishes its repository's pull requests in line (its order, label times, heads, the libraries each changes, its group status and whether its CI passed) and reads every other repository's from what their last looks published; when what it publishes changes (a pull request landed, left, was pushed, or a test started or ended), it asks for a look at every other repository of its lines, before and after, so the next front moves with no event of its own.

After a restart nothing is decided from a line until it settles: the clones are warm with the module graph read from them (before then a library change looks like none), and every repository with queued pull requests has had its first look (any of them could be ahead), and the landings' first read of the branches since (Landings) is done, so a library change that reached a default branch while the service was down holds its users. Until then no test starts, no group status is touched, nothing steps aside for its line, and no front is updated, merged up or landed: a front with a group test waits with pending "1st in its repository, waiting while the queue reads its line after a restart", and the look once the lines settle goes on.

Landings (MQ-8). A change to a library other modules use that reaches its default branch, whether the queue landed it after its group test or anything else merged or pushed it, is a landing, and the queue writes each user's dependency bump onto its default branch itself, one commit per repository, instead of the take-up pull request every release used to open in each user once per path through the graph. What reached a branch is read from its clone at each fetch, against a cursor per Go repository kept on the volume (DATA_DIR/landings/cursors.json): a repository's first read sets it; after that the files the commits since change, the queue's own bump commits aside (author merge-queue, subject Take ...), make a landing when they change a library with users, as a group test would read them; a branch rewritten past its cursor moves it with a warn line. No branch is read for landings until the clones are warm, since before then a library could look unused; a push made while the service was down is found at its first fetch. A landing is kept on the volume (DATA_DIR/landings, one JSON file each, written beside and renamed into place) with its group and the pull request that merged it, when Forgejo knows one. The library's release run on that commit (release/ci.yml, a push run) tags it; once the run has ended the tag at the commit is the module's new version (v1.2.3, or <folder>/v1.2.3 for a module in a folder), and no tag means the change released nothing, so its users take nothing. A repository without the release suite releases nothing. A user is bumped once every module of the landing it requires has its version known: a worktree of its default branch, go get of those modules at those versions and go mod tidy in each of its modules' folders (ours fetched from Forgejo with the service's token, the rest through the home proxy, caches on the volume), one commit by merge-queue naming the landing's pull request, pushed to the branch; a push refused because the branch moved is made again on the new head. A landing planned before it landed pushes each planned bump instead, where its plan holds (Prepared landings). A user that is itself a module releases from its bump, and its tag is its version for the next level. A no-take-up repository is skipped; one that already had the versions is unchanged. A bump whose go command fails is a warn line and, for a landing a pull request merged, a comment on it naming the repository and why, and the rest go on with what is known. Requires that wait on each other in a cycle fail the same way. Landings are worked one at a time, oldest first, each step brought by a run or push in a repository it waits on; a restart reads them back and goes on once startup has named every repository with its topics, since before then whether a library releases isn't known (and a repository not named yet hasn't released). The deployment's user may push to every ci-go repository's default branch for this (infra-bootstrap).

A landing that doesn't end holds its users' pull requests behind it (Lines), each saying what it waits for. Once it has held for over an hour, the first look that finds a pull request held by it logs a warn line naming the landing and what it waits for, once per landing. What clears one is what it waits for: a release run on that commit that ends, however it ends (one that failed or was cancelled counts as ended, and the landing takes no version from it; rerun with strip-owner rerun, it can still make one). A release run that never started on that commit is never started by a later push, which runs on its own commit; then, or whenever the release can't end, an admin of the landing's library repository ends it by hand: POST /landings/clear?landing=<id> (its id from GET /landings, inside the cluster only), with Authorization: token <a Forgejo token of an admin of that repository>. The landings' next step marks every user repository not bumped yet skipped ("cleared by hand by ") and the landing done, with a warn line; those users take the library by their own pull requests, and the lines stop holding them at once.

Events, no timers. Nothing polls, sleeps or runs on a schedule. At startup it reads every open pull request with the label and looks at each repository, listing its open pull requests once, which covers whatever happened while it was down; when that read fails it exits, and Kubernetes starts it again. After that a delivery brings a look only when it touches the queue, and the look reads only what the delivery says changed:

Delivery Looks when Reads
Pull request it is queued, was, or left (closed, label removed) that pull request; its timeline when its labels changed or it is new to the line; its head's statuses
Workflow run or job its run's commit is a queued pull request's head that head's statuses
Push to a branch a queued pull request goes into the front's compare with its base
Push to any repository of its owners, besides a fetch of its clone, not a look
Workflow run in a repository a batch holds a commit of, or pipeline-templates while a batch goes a step of the batches, not a look
The queue's own commit_status never: it holds what it wrote nothing
Another repository's look what it published of a line this repository is in changed nothing more than what is held

Anything else is dropped with no request: most deliveries are CI jobs on repositories with nothing queued. A repository nothing is held of (its first delivery since startup, or the first since a look at it failed) is looked at on any delivery and read whole, so a queued pull request whose look failed doesn't wait for an event about itself. A repository with pull requests turned off (one whose pull requests live on GitHub, such as agent-tools) has no queue: its deliveries are dropped, and a look reads only the repository, never its pull request list, which answers 404. The repository comes from the delivery, which Forgejo sends whole. The queue's own status write is read back once by the next look, with Forgejo's time on it. A head found up to date with its base isn't compared again until a push to the base or a landing moves it. Lists are read from page 1 and stop at Forgejo's X-Total-Count. Every decision is made as before from what is held and read; only what is read changed. A look that fails on a Forgejo error is logged and counted, and the repository's next event looks again, reading it whole.

Leaving. When the label is removed or the pull request is closed or merged elsewhere, a pending status on its head becomes success "not in the queue".

Shadow mode

(MQ-12, stage 3 step 3a.) Stage 3 moves the decision of what CI a pull request needs from each suite's scope job into anvil. Before anvil starts any run, shadow mode makes the decision for every pull request head and sets it beside what the head's native suite runs (the pull_request runs Forgejo starts itself) actually ran. It starts nothing, writes no status and changes nothing the queue does.

Deciding. The image holds pipeline-templates' package @romaine-life/ci-suites at the version the Dockerfile pins (CI_SUITES_VERSION, checked against CI_SUITES_INTEGRITY, the sha512 Forgejo's registry gives it), with node to run it. A pull request event that makes a new head (opened, synchronized, reopened) in any repository kept asks for a decision: every repository has the default suite, and its ci-* topics name the rest. Once the head and the base are in the clone, the repository's own worktree (a detached one of its clone under DATA_DIR/decide/work, made at its first decision and checked out again, --force and cleaned, for each) is put at the head, and node suites/decide.mjs --dir <worktree> --base <the event's base sha> --head <head> --repo <owner/name> --topics <the repository's topics> --pr <n> --tags <its tags, from the clone> runs, with no network, no token and no --passes (that ledger comes with step 3b). One decision per repository runs at a time, since they share its worktree, and at most two node processes at once, each stopped after two minutes and its heap held to 768 MiB; node's TMPDIR and HOME are under DATA_DIR/decide/tmp. The same head, base, topics and suites commit aren't decided twice. Each decision is a row in DATA_DIR/anvil.db (SQLite): decisions (repository, pull request, head, base, suites commit, topics, decide's output or the error, when).

Comparing. Every job event of a suite's native pull_request run (its workflow <suite>/ci.yml, not a run anvil started, whose event carries a plan) is kept on the head's shadow row for that suite: each job's last status by Forgejo's job ID, the newest run on the head only. Once the run has ended (a job's next attempt takes it back up), each of the suite's check-* jobs decide planned is set beside the run's outcome for it: a job that ran (success, failure, cancelled), was skipped, or that no event named (absent); a matrix job (check-build (go, linux)) counts for its check. A check decide plans that the run skipped while its reused-checks job posted it skipped "Identical inputs; passed on ..." is reused, which counts as run: decide has no passes to reuse yet. That post is found among every status on the head, not in the combined status: Forgejo writes the skipped job's own "Has been skipped" over it as soon as its job emitter next reads the run, which the reused-checks job ending makes it do. The two differing is a mismatch, kept on the row with which jobs differ, counted, and logged as a warn line naming the repository, pull request, head, suite, both sets of jobs and the run. A cancelled run (a newer push cancels it) is not compared. A run that ends before its head is decided is compared once it is. A restart drops decisions and rows older than 30 days; the database's versions are migrations in store.go, each applied once (PRAGMA user_version).

Reading it. Inside the cluster, GET /shadow answers how many heads were decided (and how many decisions failed), how many runs were compared and mismatched, and the newest mismatches (?limit=, 50 unless set), each with decided (each check job and whether decide planned it), native (each check job's outcome in the run), detail and the run's link. A mismatch is either decide deciding otherwise than the scope job would, which step 3b must not start runs with, or a native run that didn't end as its scope said (a job skipped because one it needs failed); detail and the run say which. decide failed lines, and merge_queue_decisions_total{result="error"} or {result="timeout"}, are heads with no decision.

Module proxy

(MQ-11, stage 6b.) A landing's release builds are to be made before it lands, so the versions they record must exist before their tags do. The module proxy serves them: Go reaches it as the first entry of its GOPROXY, https://<user>:<token>@merge-queue.home.romaine.life/goproxy/<plan>, followed by the usual proxies. It holds the plans prepared landings make (below). anvil's own go commands reach it on the loopback interface with no token, since Go sends a GOPROXY URL's credentials over https only; nothing outside the pod reaches that listener.

A plan is held in memory: the versions a landing will make, each a module path and version standing for a folder of a repository at a commit. Go's protocol is answered for those only, module paths and versions case-escaped as Go escapes them (!upper):

  • <module>/@v/list: the plan's versions of the module.
  • <module>/@v/<version>.info: the version and its commit's committer time.
  • <module>/@v/<version>.mod: the go.mod at that commit and folder, byte for byte.
  • <module>/@v/<version>.zip: golang.org/x/mod/zip's CreateFromVCS from the repository's clone at that commit and folder, which leaves out what Go leaves out of a module zip (nested modules, vendor folders) and carries the root LICENSE with a module in a folder. It runs with export-ignore and export-subst turned off, as Go turns them off when it fetches a repository itself; otherwise a file a .gitattributes marks export-ignore would leave anvil's zip and not Go's, and the h1: would differ. The blobs it reads that the blobless clone lacks are fetched first, by object id. A zip is kept on the volume (DATA_DIR/goproxy/zips), named by the module, the version and the commit's tree, so the same content is zipped once. A zip a plan serves goes with the last plan that holds it, and the store is bounded at 2 GiB: above that the oldest zips go first, each made again from its clone when next asked for.

@latest and any module or version the plan doesn't hold answer 404, and a plan anvil doesn't hold 410: either way Go goes on to the next proxy in its list.

Its token. Every request under a plan carries a Forgejo token as HTTP basic auth, its password (or its user name when there is no password): Go sends a GOPROXY URL's credentials that way, over https only. The token is accepted when it can GET /api/v1/repos/<the plan's library repository>; Forgejo's verdict, yes or no, is kept ten minutes, keyed by the token's sha256 and the repository. No token answers 401, a refused one 403, and Forgejo not answering 502, with no verdict kept. No token is logged.

The self-check is the design's correctness anchor. For every library module with users, anvil makes its own zip of the module's newest real tag (vX.Y.Z, or <folder>/vX.Y.Z, of the major version its path allows), computes the h1: hashes of that zip and its go.mod as go.sum records them, and compares them with what its users' go.sum files on their default branches record for that version. It runs once the clones are warm (after the clones ready line), again whole for a library repository's modules after each fetch of it (a new tag), and for a user's own go.sum files after each fetch of the user. Each module's result is ok (a user records anvil's zip hash, and none records another), mismatch (a user records another hash), or unknown (no user records the newest tag's zip, or there is no tag). A landing is planned only for a library whose result is ok (Prepared landings).

Prepared landings

(MQ-11, stage 6b.) A library change's landing is planned while it is still a pull request, so its users' releases are built before it lands (pipeline-templates' release/group.yml; its suites/README.md, "A landing's release builds, made before it lands"). Nothing waits on that yet: a plan that fails or doesn't hold leaves the landing as it was (Landings).

When. Each time the queue dispatches a library change's group test (at the front of its line, or behind it within the line's window), it plans that pull request's landing behind the look, when its test takes no other pull request's library change (one ahead lands first, on a default branch the plan hasn't read), its library is one module at its repository's root, the repository is on the release suite (ci-release) with tags numbered from its tags (not version-from-manifest), and the module proxy's self-check of the library is ok. Anything else is an info line, landing not planned, with its reason, counted.

What it plans.

  • The library's tag: the one its merge's release will reserve, numbered from its repository's tags as pipeline-templates' actions/release-version numbers them (nextTag, ported in releasetag.go and tested against release-version's own fixtures; version-four-part keeps .0 after the count). The module proxy serves it at the pull request's head.
  • Each user's bump, nearest first, as its landing would write it (Landings): in a worktree of its clone on its default branch, go get of the versions planned for what it requires and go mod tidy, Go reading GOPROXY=<the proxy on the loopback interface>/goproxy/<plan>|file://<DATA_DIR>/go/mod/cache/download|<home proxy>|direct with GONOPROXY=anvil.invalid and a module cache of the plan's own, removed after, so a predicted version never enters the shared one. The commit is made by git commit-tree from the bump's message with the trailer Anvil-Prebuilt: <library repository>@<head>, author and committer merge-queue <merge-queue@noreply.forgejo.romaine.life> dated the plan's time, unsigned, so release/group.mjs makes the same commit again; it is kept in the user's clone at refs/anvil/plans/<plan>/<owner>/<name>. The tag the user's release will take is predicted the same way, and a module user's version is served from that commit to the users after it.
  • A user anvil doesn't plan ("prebuild": false), and its landing bumps as before: one that is no-take-up, has a module in a folder, takes nothing, isn't on the release suite, numbers from its files, whose go command fails, or which requires a module given no planned version (so the rest of that subtree too).
  • Its id: the first 24 hex digits of a SHA-256 over the library pull request, its head (the prebuild runs there and its status goes there, so a head pushed again with the same tree is another plan) and that head's tree, the library's topics (how its tags number), each user's default branch commit and topics, every tag of those repositories, and pipeline-templates' default branch commit (the release suite's). A group test dispatched again whose plan has the same id makes nothing new and dispatches nothing.

A plan is kept on the volume as DATA_DIR/plans/<id>.json, exactly as release/group.mjs reads it (version 1: the library's repository and head, and each user with its topics, tag, parent, commit, message, author, committer and the files its bump writes over the parent, in base64), and <id>.anvil.json, anvil's own record (the predicted versions and their h1: sums, each bump and the versions it takes, the prebuild's run, the landing that took it). A restart reads them back and serves their versions again.

The prebuild. Once a plan is made, and the pull request's head is still the one planned, the queue dispatches release/group.yml on its branch with pr and plan, {"id","digest"} (the SHA-256 of <id>.json), and reports the run on the head in the context merge-queue / group release: pending linking the run, then, at the first look after the run ends (or the landing's next step, once it has landed), success, or failure for a run that failed or ended without a result. Each ends with its plan, [p:<id>]. The queue never counts that status as CI and nothing waits on it: a prebuild that fails or that Forgejo refuses is a warn line and a failed status, and its pull request lands on its CI and group test as before. GET /prebuild/<id>.json serves the plan byte for byte to a Forgejo token that can read the library's repository, checked as the module proxy checks one; a plan anvil doesn't hold is 404. It is routed publicly beside /goproxy.

Landing with a plan. A landing, when the landings record it, takes the newest plan of its repository whose head's tree is its merge commit's (a squash merge of an up-to-date head keeps it); a plan of its pull request for another tree is dropped. Then:

  • Once a planned version's real tag is known (the library's release, then each module user's), it must be the one predicted, and go mod download -json of it, fetched as a user's build fetches it, must give the h1: sums the plan recorded.
  • A user whose bump takes exactly the versions its planned bump takes, none of them dropped, gets its planned commit pushed as a fast-forward while its default branch is still the planned parent ("planned": "pushed" in GET /landings), or already there (pushed before a restart cut the step short of saving it); one whose branch moved gets its bump written on the new head as before, with the plan's message and trailer ("planned": "written"), whose release takes the prebuild's files only if it builds the same (prior-build.mjs findAnvil). Any other is bumped as without a plan, and so is everything downstream of it.

Each mismatch is an info line, plan dropped, naming the module or repository, the reason (tree, tag, sums, versions, or upstream for a version dropped above it) and why; the landing's planOff keeps it.

An app's planned commit, pushed or written, has its delivery held first (Batched delivery, below).

Pruning. A plan is served until its landing is done, its release runs ended, since findAnvil reads it then. Once that landing is done, a newer plan of the same pull request replaces it, or no landing took it in three days (the prebuild's files are kept three days), its versions leave the proxy, its files the volume and its commits' refs the clones, at the next plan made or landing done.

Batched delivery

(MQ-11, stage 6b.) A landing's planned bumps release every app that uses the library. Rather than each release run publishing its app and asking every PC to install it alone, the runs end at their complete drafts and the queue delivers them together, through pipeline-templates' .forgejo/workflows/deliver.yml, so each PC installs the batch in one at-update pass. The contract is pipeline-templates' release/batch.mjs (its suites/README.md, the batch section): a release run of a commit carrying the Anvil-Prebuilt: trailer ends as a draft while the commit's newest merge-queue / delivery status is merge-queue's own and pending.

Its members. A landing's batch holds each app (its app topic) whose planned commit the landing pushes, or writes with the plan's message on a branch that moved (Landing with a plan). Not held: an app with an external part (release-external, which gives its release plan the part build.yml makes), since a callback run completes its draft and never batches; and the library's own merge, which carries no trailer, so its run never asks (finalize runs batch.mjs only for a trailed commit).

Holding a commit. Forgejo refuses a status on a commit it doesn't have (404), so the status can't go on before the push the plain way, and posting it after the push leaves the release run a window to read none. The queue closes it: the member is kept on the volume first; then the commit is pushed to a ref of its own on Forgejo, refs/anvil/delivery/<commit>, which Forgejo neither announces (no push event, webhook or workflow is started for a ref outside branches and tags) nor runs anything for; then merge-queue / delivery goes on it, pending "delivered with 's batch", linking the landing's pull request; then the branch is pushed, which starts the release run. No run of the commit can exist before its status does. Once the branch has it the staging ref is deleted. A post that answers an error may still have been kept (a timeout, a 5xx after the write): the commit's statuses are read, and one that carries the pending status is held; one whose statuses can't be read is held too, its status posted again at the next step, since a commit left pending with nothing following it would stay a draft while one whose status never came only publishes itself. A push refused because the branch moved, or one that fails, takes the commit out of the batch and sets its status success (it never reached the branch); its bump written again on the new head is held again. Any other step of the hold that fails is a warn line and the commit delivers itself, as without a batch.

Following it. Each member's release run is followed as the landings follow one (release/ci.yml on the commit's push). Once it ends, the member is:

  • held: the run succeeded and the release at the commit (the tag its run made there) is a draft, finalized (not a pre-release). Its status stays pending.
  • self: the run published it itself (release/batch.mjs decided it isn't batchable); status success, "delivered by its own release run".
  • none: the run made no release; status success.
  • failed: the run failed or was cancelled; status failure, "not in the batch: its release run failed; a rerun delivers it itself", since a run of it after that status publishes and delivers itself. So is a run a killed runner left behind, which never ends: its jobs' statuses on the commit show nothing left but jobs blocked behind a failed one (the queue's markAbandoned).

A run that never starts never ends either, and its landing waits on it too (Landings). An admin ends that landing by hand, POST /landings/clear, which settles its batch as well: every member whose run hasn't ended is failed ("its landing was cleared by hand"), and the rest go out.

Statuses. Each member's status is the one its state calls for, and the batch keeps which one Forgejo has taken. One that fails to post is posted again at every step until Forgejo takes it, so a commit is never left pending by a lost write; a batch is done only once every member's status is its final one.

Delivering. Once no member can join (the landing is done, or every one of its bumps has been written, read from the snapshot the lines read) and no member's run is still going, the queue dispatches deliver.yml in pipeline-templates on main with batch, {"version":1,"landing","releases":[{"repo","tag"}]}, naming the held members only (by repository). It doesn't wait for the landing to be done: the landing also waits on module users' releases, and a member whose run counts as failed holds back no sibling. Before dispatching, it looks for a deliver.yml run whose event (its batch input) names this landing, and follows that one instead: a dispatch whose answer was lost, or a restart before its record, never starts a second. Each held member's status is then pending "delivering with 's batch" linking the run, and the landing's pull request gets a comment naming the batch, its run, and the members that delivered themselves or failed. The result is the run's deliver job's (publish the drafts, ask the PCs); its prune job after it is cleanup, whose failure delivers nothing less. Each held member's status is then success or failure linking the run, and a failure is commented too. With no member held nothing is dispatched. A dispatch Forgejo refuses sets each held member's status failure with Forgejo's message (a rerun of its release delivers it) and comments.

A batch is kept on the volume (DATA_DIR/batches, one JSON file per landing) at each change, each write whole (a file of its own beside it, renamed into place) and one at a time, so the file is never older than the last change; a restart reads back those not done and goes on, and a file that can't be read is renamed <name>.unreadable with a warn line, its batch dropped, the rest read. Nothing runs on a timer: every step reads again each run a batch waits on, so a lost event costs only the wait for the next of any of these: a member's release run event, any workflow run event in pipeline-templates while a batch goes, or a step of the landings.

Observability

GET /health answers ok. GET /metrics (Prometheus text) counts webhook deliveries by event, those that brought a look and those dropped untouched by event, requests to Forgejo by method, and rejections by reason, looks and failed looks, landings, updates, Go merge-ups and step-asides by reason per repository, and gauges queued pull requests per repository. It counts clones and fetches by result and their time by repository, and gauges the clones by state (ready, failed, pending) and the modules in the graph. It counts group tests dispatched per repository, of those the speculative ones (behind the front of their line) and those dispatched again for a changed key; it gauges the lines (all of them, and those across repositories), the pull requests in each line by its front, each repository whose front waits behind another repository's pull request, the pull requests per repository whose tests wait beyond their line's window, and the pull requests per repository held behind a landing in progress. Each look that changes a line across repositories logs a line line naming its front and its pull requests in order. It counts bumps by result (pushed, unchanged, skipped, failed), and GET /landings lists every landing not done and where each repository's bump stands. A failed clone or fetch is a warn line naming the repository and git's error; once every repository named at startup has been tried, one clones ready line says how many are ready and failed, the modules in the graph, and the five largest groups. Inside the cluster, GET /mirrors lists every repository kept, its default branch and whether its clone is ready or why not, and GET /group?module=<path> answers a module's group as JSON. Each decision is one line on stdout in the estate's log line (logline, AHT-204): what as the message, then repo, pr, head and why (masked, since it can hold Forgejo's error text); a step aside is a warn. No token or secret is logged.

Shadow mode counts decisions by result (ok, error, timeout), their time (merge_queue_decide_seconds, a histogram from the checkout to the record) and mismatches by suite (merge_queue_shadow_mismatch_total); each decision is an info line naming the jobs it planned per suite, and each mismatch a warn line (Shadow mode).

The module proxy counts its requests by answer (served, not_found, gone, refused, error), gauges the library modules by their self-check's result (ok, mismatch, unknown) and the bytes of zips it keeps. Inside the cluster (the route carries only /goproxy), GET /selfcheck answers whether the clones were warm and each library module's newest tag, anvil's two hashes, its result and why, what each user's go.sum records, and each mismatch with both hashes. A mismatch is a warn line naming the module, the version, the user and both hashes, once each; a module's result changing is an info line, and so is each zip made.

Prepared landings count the landings planned by repository, those not planned and the plans dropped by reason, and the prebuilds dispatched, refused, passed and failed. Inside the cluster GET /plans lists every plan held, with each user's bump or why it has none, its prebuild's run and result, and the landing that took it. A plan made, a prebuild started or passed, a landing taking its plan and a plan pruned are info lines; a prebuild that failed or didn't start is a warn.

Batched delivery counts batches by outcome (merge_queue_batches_total: delivered, failed, refused, empty), their members by outcome (merge_queue_batch_members_total: held, self, none, failed, dropped), and the releases each dispatched batch delivers (merge_queue_batch_size, a histogram). Inside the cluster GET /batches lists every batch not done, its members and their outcomes, and its run. A delivery held, a member settled, a batch dispatched (or its run found started), delivered or empty are info lines; a hold that failed, a batch that failed or didn't start, a batch file that can't be read, a warn.

Configuration

Variable Default
FORGEJO_URL https://forgejo.romaine.life
FORGEJO_TOKEN_FILE the merge-queue user's token
WEBHOOK_SECRET_FILE the webhook's HMAC secret
LISTEN :8080
DATA_DIR the volume; the clones go in its clones folder, the module proxy's zips in goproxy, prepared landings' plans in plans, batches in batches
OWNERS romaine-life,nelsong6 whose repositories it keeps
LINE_WINDOW 3 how many pull requests of a line that are tested, from its front, have their group tests started (Lines)
CI_SUITES the image's /opt/ci-suites the suites package shadow mode runs; unset, shadow mode is off

A missing or empty file, no DATA_DIR, a LINE_WINDOW that isn't a whole number from 1, or a CI_SUITES that holds no package naming the commit it was published from (its gitHead), or no node, stops it at start with the variable's name.

Testing

go test -p 4 -race ./.... The test that runs decide through the real package runs only with node on PATH and CI_SUITES naming an unpacked @romaine-life/ci-suites with npm ci run in its suites/, as the image holds it; elsewhere it is skipped. The tests run the queue against a fake Forgejo in memory, with a clock that moves one second per event, so nothing waits, and the clones and module graph against bare repositories on disk served by git as Forgejo serves them. CI also checks gofmt and go vet, builds the image, starts it against a stand-in Forgejo and checks that an unsigned delivery is refused, and validates k8s/.

A plan must be what pipeline-templates' release/group.mjs reads, and each planned commit the one it makes again. prepare_test.go checks the commits against group.mjs's steps done in git, and the plan against testdata/plan-golden.json: a plan its fixture makes (dated, so the same bytes each run), with the commits group.mjs's own parsePlan and recreate made of it. With PIPELINE_TEMPLATES naming a pipeline-templates checkout whose suites' dependencies are installed (npm ci in suites/), the test runs group.mjs itself through testdata/recreate.mjs, and with UPDATE_GOLDEN=1 writes the golden file again, which a change to the plan needs.

Shipping

CI is pipeline-templates' go and cluster-service suites (its fleet.json). A pull request runs gofmt, vet, the tests and the tests again under the race detector, renders and checks k8s/, and builds the image and runs its --self-test (selftest.go: against a stand-in Forgejo with no queued pull requests or repositories it starts as on the cluster, runs git and go, has node load the suites package's decide.mjs with every module it imports, answers /mirrors, /selfcheck, and a 410 for a plan the module proxy doesn't hold, refuses unsigned and wrongly signed deliveries, and counts them in /metrics). A merge that changes the image releases it (v0.1.N) to forgejo.romaine.life/romaine-life/merge-queue with a the job's own short-lived token as the registry password (nelson's Forgejo integration ci-image-publish, BAO-15; nothing stored), and opens a pull request pinning k8s/deployment.yaml to the new tag and digest. Argo CD on the home cluster (nelsong6/home-cluster) syncs k8s/ once that merges.

The image build reads the suites package (Shadow mode) from Forgejo's npm registry with the job's own sign-in for packages, which the suites give a repository with a tracked .npmrc naming FORGEJO_PACKAGES_TOKEN (this one's root) and the build mounts as a secret. A new version is a PR here moving CI_SUITES_VERSION and CI_SUITES_INTEGRITY together, the integrity read from the registry's document for that version; no package.json is kept, which pipeline-templates' npm take-up would read as a repository to bump.

Provisioning

configure.ps1, run by hand from a home PC; rerunning it is safe and rotates the token and the webhook secret. It makes the Forgejo user merge-queue (a site admin, so it reaches every repository, with a password nobody keeps), gives it a token with write:repository and write:issue only, makes a new webhook secret, and writes them to OpenBao through the NAS. It then replaces the instance-wide webhook to http://merge-queue.merge-queue.svc.cluster.local:8080/webhook (pull requests, pushes, workflow runs and jobs), and, once the service is deployed, syncs its secrets and restarts it. Forgejo must allow that host in [webhook] ALLOWED_HOST_LIST (nelsong6/forgejo).