-
Notifications
You must be signed in to change notification settings - Fork 140
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
Run all commands through a shell interpreter #124
Conversation
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.
I think this is going to be a good change! Even though it feels strange in Docker land.
hooks/commands/run.sh
Outdated
@@ -8,6 +8,7 @@ run_service="$(plugin_read_config RUN)" | |||
container_name="$(docker_compose_project_name)_${run_service}_build_${BUILDKITE_BUILD_NUMBER}" | |||
override_file="docker-compose.buildkite-${BUILDKITE_BUILD_NUMBER}-override.yml" | |||
pull_retries="$(plugin_read_config PULL_RETRIES "0")" | |||
shell="$(plugin_read_config SHELL "/bin/bash -c")" |
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.
I think we have -e
in the vanilla bootstrap command hook, to ensure that commands don't keep executing if one fails
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.
Could we just default to /bin/sh
, which on most systems will just be bash
anyway?
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.
Yup, I reckon you are totes correct on both calls. As always you are a fine human to collaborate with.
.buildkite/pipeline.sh
Outdated
- echo \$ALPACAS | ||
- pwd | ||
- echo "llamas rock too" | ||
shell: "/bin/sh -c" |
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.
I think this needs to be under the plugin block?
d15eb8b
to
69aa558
Compare
Ugh, so how do we handle containers without a shell in them? |
Yeah, that's the same trouble I had trying to use the docker plugin with the plugin-linter and trying to pass it command line args. Hrmmmm… |
|
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.
I don't have any strong feels, happy with what ever you choose!
|
I guess you'd never want to use |
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.
Shell false looks good!
I think we're going to have to update the way we actually pass the command to run
if shell is false (4ed5ea4#diff-e0e3e4340eb68e96c2657414fb30f290R121). I don't think we want to quote it.
README.md
Outdated
@@ -293,7 +293,7 @@ The default is `false`. | |||
|
|||
### `shell` (optional, run only) | |||
|
|||
The shell that is used to invoke commands. This is so that multiple commands can be interpretted. | |||
The shell that is used to invoke commands. This is so that multiple commands can be interpretted. if `false` is specified, the command is invoked directly. |
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.
The shell that is used to invoke commands. Set to false
to disable running the commands via a shell (useful for images that expect command arguments to passed directly).
16a008c
to
32b4537
Compare
I'm going to close this for now, I think some more thinking is needed around how to handle multiple commands and containers without shells. |
Multiple commands get passed through as new-line delimited commands. Docker needs a single command, so this currently doesn't work. This sets a standard command to execute $BUILDKITE_COMMAND in of
/bin/sh -e -c
, you can provide an alternative via theshell
parameter.The downside is that this are:
/bin/sh
in your containerWe could possibly only do this if there is multiple commands, but in some ways that just makes it more magical IMO.