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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user