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:
2026-11-10 16:06:40 +00:00
parent d77b36f56f
commit 532ba48927
9 changed files with 537 additions and 29 deletions
+5
View File
@@ -196,6 +196,11 @@ func TestRetainedStageDiffsSurviveCommittedMergeAndNoopVisit(t *testing.T) {
}
runGit(t, workspace, "add", "source.txt")
runGit(t, workspace, "commit", "-qm", "base")
// Run from a linked worktree: a run started from a main checkout would get
// its own worktree, away from the files this fake stage edits.
item := filepath.Join(t.TempDir(), "item")
runGit(t, workspace, "worktree", "add", "-q", "-b", "item", item)
workspace, path = item, filepath.Join(item, "source.txt")
branch := runGitOutput(t, workspace, "branch", "--show-current")
r, err := newRunner(ctx, store)