Promotion runs on a self-hosted runner on each Server

Promotion (Branch Environment โ†’ stage โ†’ prod) runs as three GitHub Actions workflows that adops init writes into the Project: adops-pull-request.yml (validate and adops run --all --branch on PR open or update, adops drop-branch on PR close), adops-stage.yml (merge to main) and adops-prod.yml (release published, behind the GitHub environment prod with required reviewers). Every job that touches a Warehouse runs on a self-hosted GitHub Actions runner installed on that Environment's Server machine, labelled adops-stage or adops-prod, and runs adops inside the Server image with docker compose run --rm. Warehouse secrets stay in that machine's .env; they are never GitHub secrets. This reverses ADR-0014's rejection of a self-hosted runner and replaces its Git-pulling Server (see the ADR-0014 clarification of 2026-11-21).

Fork PR policy. A pull request from a fork gets only adops validate, on a GitHub-hosted runner, with no secrets and no Branch run. The job condition that routes a Fork PR there is not a security boundary: a Fork PR can change the workflow file, and its version is what runs. The boundary is GitHub's fork approval setting under Settings > Actions > General, which must stay on at its strictest: Require approval for fork pull request workflows (private repository) or Require approval for all external contributors under "Approval for running fork pull request workflows from contributors" (public repository; formerly "Require approval for all outside collaborators"). GitHub advises that self-hosted runners should almost never be used for public repositories, because anyone can open a pull request and run code on the machine (Hardening for self-hosted runners); a private repository is the supported setup.

One Warehouse lock. Every Warehouse-touching run (Branch run, deploy, Schedule, drop-branch) takes a Warehouse lock per Pipeline run: a Postgres session advisory lock, or flock on <duckdb file>.lock. It waits a fixed 30 minutes, then fails without retry. Branch runs and drop-branch take stage's lock. A Server must be a Linux host, because flock is not reliably shared through a Docker Desktop for macOS bind mount.

Clarification (2026-11-23): The Linux-host rule applies to Servers whose Warehouse is a DuckDB file, the only case where the lock is a flock. A Server with a Postgres Warehouse takes a Postgres advisory lock and may run on macOS: tried on OrbStack, not on Docker Desktop (docs/playbooks/run-stage-and-prod-on-a-mac.md).

Clarification (2026-11-27): A stage or prod deploy no longer moves the Server folder with git fetch and git checkout, which changed files under a run in progress. After validate, adops server-release (run in the Server image, with the runner's checkout mounted read-only at /checkout) copies the validated commit into <Server folder>/releases/<commit>, links the shared .env and .adops/ into it, and points a relative current link at it in one rename. The reload follows, then adops run --all --project /project/current. The Server reads its Project from /project/current (ADOPS_PROJECT); the bind mount, compose project folder and compose project name are unchanged, so run history and data volumes survive. docker-compose.yml and server/*.yaml stay at the Server folder root: a commit that changes them stops the deploy for a manual update. Old releases are deleted down to the newest 3 plus current and every folder a run in progress uses. An existing Server moves to this layout once by hand (docs/playbooks/promotion.md, "One-time move to release folders").

Considered Options: a GitHub-hosted runner for everything (it cannot reach a localhost Postgres or a DuckDB file Warehouse, and stage/prod secrets would live in GitHub); the Git-pulling Server of ADR-0014 (it needs Git credentials on the Server, a polling loop and a rule for "latest release", none of which a push from the runner needs); GitHub pushing to the Server over SSH (the Server must accept inbound connections); relying on the job condition alone to keep fork code off the Server (a Fork PR can edit it); a lock around a whole adops run --all (one slow deploy would hold off every Branch run for its full length).

Consequences:

Clarification (2026-11-27, deploys rerun only Changed Steps): The deploy's run step is now adops run --all --changed --env stage|prod --project /project/current, which reruns only each Pipeline's Changed Steps (ADR-0014 clarification of the same date). The Deploy Plan is made inside the Warehouse lock, so a scheduled run that overlaps a deploy waits for the lock and then runs against what the deploy saved; the two never write at once. This was proven by unit tests and one postgres-only stage case in the e2e suite, not on a real self-hosted runner: a retrial on a real runner is a follow-up.

Clarification (2026-11-30, parallel Pipelines on Postgres): On a Postgres Warehouse the Warehouse lock is per Pipeline. A run holds the fixed Warehouse-wide advisory key shared, plus an exclusive advisory key in the two-int key space derived from a hash of its Pipeline's YAML name:. Runs of different Pipelines overlap; runs of the same Pipeline (stage, Branch and accept-schema --branch share stage's key for it) never do. drop-branch and the Settings Marker save take the Warehouse-wide key exclusively with a blocking lock under lock_timeout, so they wait for every Pipeline run and are not starved by new ones. DuckDB keeps its single flock.