Pipeline runs use the workspace's directory environment

Resolve the run workspace's environment with workenv (direnv, parent
.envrc, mise; same account rule as Claude chats) at run start and resume,
and apply it to Pi stage processes, a per-environment Pipelines-owned
OpenCode stage service (keyed by a hash of the change, reused across runs,
idle ones stopped after PIPELINES_OPENCODE_STAGE_IDLE_TIMEOUT, revived per
registration), delivery-gate checks and merges, plain-stage opencode CLI
calls and file-change capture git reads. Record the directory, .envrc
files, sources and variable names (never values) on the run detail; a
blocked .envrc becomes a run warning.
This commit is contained in:
2026-11-04 18:08:42 +00:00
parent e0d7b720f5
commit cedfc22e45
26 changed files with 1173 additions and 84 deletions
+5
View File
@@ -14,6 +14,7 @@ import (
"time"
"git.a-wan.net/alan/pipelines/internal/stage"
"git.a-wan.net/alan/pipelines/internal/workenv"
)
// verifyDelivery proves that the stage landed a complete, committed tree before
@@ -204,6 +205,7 @@ func cleanupDeliveryCandidate(workspace, candidate string) {
func boundedCommandOutput(ctx context.Context, directory string, args ...string) ([]byte, error) {
cmd := exec.CommandContext(ctx, "git", append([]string{"-C", directory}, args...)...)
cmd.Env = workenv.CommandEnv(ctx, directory)
var output boundedDeliveryOutput
cmd.Stdout = &output
cmd.Stderr = &output
@@ -214,6 +216,9 @@ func boundedCommandOutput(ctx context.Context, directory string, args ...string)
func runDeliveryCheck(ctx context.Context, directory, check string) error {
cmd := exec.CommandContext(ctx, "sh", "-c", check)
cmd.Dir = directory
// The run workspace's own environment (direnv/mise), as a terminal there
// would have it; nil inherits the server's.
cmd.Env = workenv.CommandEnv(ctx, directory)
var output boundedDeliveryOutput
cmd.Stdout = &output
cmd.Stderr = &output