-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add SD_STEP_NAME env variable #439
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to my change, but I noticed that the commit introducing this 'echo' statement (2556c79 / #109) unintentionally broke the status check on the next line ( It shouldn't really make a difference (i.e. If you have a preferred fix among those options, I am happy to send a separate pr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, u can use that printf or echo, whichever can wrap a newline before and after will do |
||
";echo " + guid + " $?\n", | ||
|
@@ -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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is described here: https://github.com/screwdriver-cd/data-schema/blob/b7cf7ab0bc5039570aeb03daa790f0d67e183544/config/job.js#L92-L103