-
Notifications
You must be signed in to change notification settings - Fork 88
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
override shell used for step scripts #35
base: master
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -27,7 +27,11 @@ func setupScript(src *resource.Step, dst *engine.Step, os string) { | |
// helper function configures the pipeline script for the | ||
// windows operating system. | ||
func setupScriptWindows(src *resource.Step, dst *engine.Step) { | ||
dst.Entrypoint = []string{"powershell", "-noprofile", "-noninteractive", "-command"} | ||
sh := "powershell" | ||
if len(src.Shell) != 0 { | ||
sh = src.Shell | ||
} | ||
dst.Entrypoint = []string{sh, "-noprofile", "-noninteractive", "-command"} | ||
dst.Command = []string{"echo $Env:DRONE_SCRIPT | iex"} | ||
dst.Envs["DRONE_SCRIPT"] = powershell.Script(src.Commands) | ||
dst.Envs["SHELL"] = "powershell.exe" | ||
|
@@ -36,7 +40,11 @@ func setupScriptWindows(src *resource.Step, dst *engine.Step) { | |
// helper function configures the pipeline script for the | ||
// linux operating system. | ||
func setupScriptPosix(src *resource.Step, dst *engine.Step) { | ||
dst.Entrypoint = []string{"/bin/sh", "-c"} | ||
sh := "/bin/sh" | ||
if len(src.Shell) != 0 { | ||
sh = src.Shell | ||
} | ||
dst.Entrypoint = []string{sh, "-c"} | ||
dst.Command = []string{`echo "$DRONE_SCRIPT" | /bin/sh`} | ||
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. Should this shell invocation also use the overridden shell? I am not familiar enough with the script compiler to judge whether this would be a good idea or not. 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. so looking at what gets eventually gets called is https://github.com/drone/runner-go/blob/0bd0f8fc31c489817572060d17c6e24aaa487470/shell/bash/bash.go#L26
where we pipe the commands into |
||
dst.Envs["DRONE_SCRIPT"] = shell.Script(src.Commands) | ||
} |
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.
Looking over the change once more, I realize that maybe we also want to pass the name of the overridden shell to the executing script. Although I am not sure about the role of the file extension here.
I am also not sure if/where a similar thing is done on the Linux side of things.