Skip to content

Commit

Permalink
feat: add SD_STEP_NAME env variable (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtolar authored Jun 22, 2022
1 parent b111303 commit b3c5435
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ func doRunSetupCommand(emitter screwdriver.Emitter, f *os.File, r io.Reader, set
return nil
}

func doRunCommand(guid, path string, emitter screwdriver.Emitter, f *os.File, fReader io.Reader) (int, error) {
func doRunCommand(guid, path string, emitter screwdriver.Emitter, f *os.File, fReader io.Reader, stepName string) (int, error) {
executionCommand := []string{
"export SD_STEP_ID=" + guid,
// escape not necessary because step name is limited to [A-Za-z0-9_-]
";export SD_STEP_NAME=" + stepName,
";. " + path,
";echo",
";echo " + guid + " $?\n",
Expand Down Expand Up @@ -336,7 +338,7 @@ func Run(path string, env []string, emitter screwdriver.Emitter, build screwdriv
fReader := bufio.NewReader(f)

go func() {
runCode, rcErr := doRunCommand(guid, stepFilePath, emitter, f, fReader)
runCode, rcErr := doRunCommand(guid, stepFilePath, emitter, f, fReader, cmd.Name)
// exit code & errors from doRunCommand
eCode <- runCode
runErr <- rcErr
Expand Down

0 comments on commit b3c5435

Please sign in to comment.