diff options
author | Simon Westphahl <simon.westphahl@bmw.de> | 2022-08-23 13:31:54 +0200 |
---|---|---|
committer | Simon Westphahl <simon.westphahl@bmw.de> | 2022-08-23 14:31:02 +0200 |
commit | 7b68214ea6ba683ede44d500cd37844e6e85b675 (patch) | |
tree | 3145b3af056198039a95c8da0d14cabdddc3169a /tools | |
parent | 4c3dd064d7a3c523fa85c04f0aceca3ecef663b6 (diff) | |
download | zuul-7b68214ea6ba683ede44d500cd37844e6e85b675.tar.gz |
Run docker-compose up test setup script with env
When not using a ROOTCMD when running the test-setup-docker.sh the
script will fail with the following error message:
++ id -u
+ USER_ID=1000 docker-compose up -d
./test-setup-docker.sh: line 50: USER_ID=1000: command not found
Due to Bash's simple command expansion[0] variable assignments will be
interpreted as the command when no ROOTCMD is given. To work around this
we use default ROOTCMD to the `env` command.
[0]: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Simple-Command-Expansion
Change-Id: Id696069a4eec2b2c2513ac449098b0ef73dc3906
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/test-setup-docker.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/test-setup-docker.sh b/tools/test-setup-docker.sh index 81f4b2977..a0fcf9f5a 100755 --- a/tools/test-setup-docker.sh +++ b/tools/test-setup-docker.sh @@ -8,7 +8,11 @@ # environment. set -xeu -ROOTCMD=${ROOTCMD:-} + +# Default ROOTCMD to the 'env' command, otherwise variable assignments will be +# interpreted as command when no ROOTCMD is given. The reason for that is +# Bash's simple command expansion. +ROOTCMD=${ROOTCMD:-env} cd $(dirname $0) SCRIPT_DIR="$(pwd)" |