Skip to content

Commit

Permalink
Set parent process env in steps running on host VM (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham149 authored Dec 23, 2021
1 parent 0af0af6 commit 317c858
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ func (e *Engine) Run(ctx context.Context, step *spec.Step, output io.Writer) (*r
e.mu.Unlock()

envs := make(map[string]string)
if step.Image == "" {
// Set parent process envs in case step is executed directly on the VM.
// This sets the PATH environment variable (in case it is set on parent process) on sub-process executing the step.
for _, e := range os.Environ() {
if i := strings.Index(e, "="); i >= 0 {
envs[e[:i]] = e[i+1:]
}
}
}
for k, v := range cfg.Envs {
envs[k] = v
}
Expand Down

0 comments on commit 317c858

Please sign in to comment.