From 6c2d351f5466d42c4d227f5627bd3709c266b5ce Mon Sep 17 00:00:00 2001 From: Dongjoon Hyun Date: Fri, 3 May 2019 10:13:22 -0700 Subject: [PATCH] [SPARK-27626][K8S] Fix `docker-image-tool.sh` to be robust in non-bash shell env ## What changes were proposed in this pull request? Although we use shebang `#!/usr/bin/env bash`, `minikube docker-env` returns invalid commands in `non-bash` environment and causes failures at `eval` because it only recognizes the default shell. We had better add `--shell bash` option explicitly in our `bash` script. ```bash $ bash -c 'eval $(minikube docker-env)' bash: line 0: set: -g: invalid option set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] bash: line 0: set: -g: invalid option set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] bash: line 0: set: -g: invalid option set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] bash: line 0: set: -g: invalid option set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] $ bash -c 'eval $(minikube docker-env --shell bash)' ``` ## How was this patch tested? Manual. Run the script with non-bash shell environment. ``` bin/docker-image-tool.sh -m -t testing build ``` Closes #24517 from dongjoon-hyun/SPARK-27626. Authored-by: Dongjoon Hyun Signed-off-by: Dongjoon Hyun --- bin/docker-image-tool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/docker-image-tool.sh b/bin/docker-image-tool.sh index 0388e23979..68fafbb848 100755 --- a/bin/docker-image-tool.sh +++ b/bin/docker-image-tool.sh @@ -282,7 +282,7 @@ do if ! minikube status 1>/dev/null; then error "Cannot contact minikube. Make sure it's running." fi - eval $(minikube docker-env) + eval $(minikube docker-env --shell bash) ;; u) SPARK_UID=${OPTARG};; esac