Run every pipeline run in its own worktree
A fresh run started from a repository's main checkout gets its own worktree and branch next to the repository, so runs never share a tree or see the operator's uncommitted work, and several can run at once. Retries and runs started in a linked worktree keep their directory. A clean, landed run tree is removed after success; anything else is kept. The delivery gate commits what the land stage left uncommitted in a run worktree, and no longer requires the operator's main checkout to be clean: Git's fast-forward refuses safely when a local change conflicts.
This commit is contained in:
@@ -161,10 +161,26 @@ A workflow that commits its change ends in `land`: a model stage with
|
||||
3. No empty commit, push, amend or rebase. Report the hash.
|
||||
|
||||
With `delivery=true` and `checks` commands, after `land` succeeds the server:
|
||||
requires the item and main checkouts to be clean, untracked files included; merges
|
||||
commits whatever the run left uncommitted when the item is the run's own
|
||||
worktree (see "Run worktrees" below); requires the item checkout to be clean,
|
||||
untracked files included (the main checkout need not be: the final
|
||||
fast-forward is Git's `merge --ff-only`, which refuses without touching
|
||||
anything when a local change would be overwritten); merges
|
||||
a moved `main` into the item (a conflict aborts with the workspace unchanged);
|
||||
runs each check with `sh -c` from the root of a fresh detached worktree of the
|
||||
commit, so include dependency bootstrap (`npm ci && npm test`); caps each check's
|
||||
output at 64 KB; and fast-forwards `main`. A failing check blocks landing. Do not
|
||||
check ancestry before the gate runs. Without a gate, the manager merges and
|
||||
verifies ancestry; no separate merger pipeline is needed (`references/queue.md`).
|
||||
|
||||
## Run worktrees
|
||||
|
||||
A run started from a repository's main checkout runs in its own worktree:
|
||||
`<repo>-runs/<date>-<title>-<hex>` next to the repository, on branch
|
||||
`pipelines/run-<same>`, from the checkout's current `HEAD`. Runs never share a
|
||||
tree, never see the operator's uncommitted work, and any number can run at
|
||||
once. A run started inside a linked worktree (an item's tree) and every retry
|
||||
use their directory as is. After a successful run whose tree is clean and
|
||||
whose branch is on `main`, the server removes the tree and branch; anything
|
||||
else (a failed run, unlanded commits, stray files) is kept for recovery.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user