Closed stjohnjohnson closed 7 years ago
This makes sense to me.
(how to handle quoting here?)
What do you mean by this? Shouldn't it work similarly to currently: https://github.com/screwdriver-cd/launcher/blob/master/launch.go#L237-L246
So for each step we need to write to a temporary file, would that add too much overhead if someone has a lot of steps?
@d2lam previously we could just spawn the command with environment set. In this case we're running a shell and executing export
in the shell. This will allow users to do more "creative" environment setting, but at the risk of shell exploiting.
Maybe you're right, we should not support "creative" environment setting via the environment feature. Instead they need to use a step that calls export
I agree on not making it easy to do weird environment things. Not for security and shell exploits or anything, it just makes for a confusing interface.
This seems like a reasonable plan. We just need to make sure the random id doesn't end up in logs as well.
/bin/sh
with the ability to manipulate STDIN
#!/bin/sh -e
Instead of Starting /bin/sh
with control of STDOUT
, STDERR
, STDIN
,
our current implementation for that part is as follows:
/bin/sh
in a pseudo-terminal using https://github.com/kr/ptypty
:
set -e
)pty
to emitter
directly##
in the env
output
on
Fixed the unit test.
What we tried:
c := exec.Command("sh")
then turned off interactive by set +o interactive
. Didn't workc := exec.Command("sh", "+o interactive")
. Still didn't workWhat worked
PS1=""
to list of default environment variables.Using export
Using another script
Currently we don't pass environment variables or cwd between steps because we execute all commands separately in sub-shells, this causes fun issues like:
This happens because
SSH_AUTH_SOCK
is set in the first step, but not passed into the second one.The proposed solution to this is to follow something similar to Wercker:
/bin/sh
with control ofSTDOUT
,STDERR
,STDIN
export FOO=bar
(how to handle quoting here?)#!/bin/sh -e
)source $STEP_SCRIPT ; echo "UNIQUE_ID $?"
UNIQUE_ID
to come back fromSTDOUT
along with the exit code