mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Make 'build' commands work with non-interactive shells.
Tested that both './build/release.sh < /dev/null' and './build/shell.sh' work.
This commit is contained in:
parent
272b9306c4
commit
5f12245d6c
@ -343,10 +343,23 @@ function kube::build::run_build_command() {
|
||||
|
||||
kube::build::prepare_output
|
||||
|
||||
local -a docker_run_opts=(
|
||||
"--name=${KUBE_BUILD_CONTAINER_NAME}"
|
||||
"${DOCKER_MOUNT_ARGS[@]}"
|
||||
)
|
||||
|
||||
# If we have stdin we can run interactive. This allows things like 'shell.sh'
|
||||
# to work. However, if we run this way and don't have stdin, then it ends up
|
||||
# running in a daemon-ish mode. So if we don't have a stdin, we explicitly
|
||||
# attach stderr/stdout but don't bother asking for a tty.
|
||||
if [[ -t 0 ]]; then
|
||||
docker_run_opts+=(--interactive --tty)
|
||||
else
|
||||
docker_run_opts+=(--attach=stdout --attach=stderr)
|
||||
fi
|
||||
|
||||
local -ra docker_cmd=(
|
||||
docker run "--name=${KUBE_BUILD_CONTAINER_NAME}"
|
||||
--interactive --tty
|
||||
"${DOCKER_MOUNT_ARGS[@]}" "${KUBE_BUILD_IMAGE}")
|
||||
docker run "${docker_run_opts[@]}" "${KUBE_BUILD_IMAGE}")
|
||||
|
||||
# Remove the container if it is left over from some previous aborted run
|
||||
docker rm "${KUBE_BUILD_CONTAINER_NAME}" >/dev/null 2>&1 || true
|
||||
|
Loading…
Reference in New Issue
Block a user