From 96318bda1d56d8e895594cba1bbb02240e211b73 Mon Sep 17 00:00:00 2001 From: Kjell Winblad Date: Mon, 20 Feb 2023 18:44:34 +0100 Subject: [PATCH] build: run run.sh tests without being asked for sudo password This commit makes it possible to run the scripts/ct/run.sh script without being asked for sudo password if one instead wants to use the run docker container with root user trick to reset owner of files. One simply has to set the environment variable EMQX_TEST_DO_NOT_RUN_SUDO. --- scripts/ct/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ct/run.sh b/scripts/ct/run.sh index 40857c46b..7e4c06c3e 100755 --- a/scripts/ct/run.sh +++ b/scripts/ct/run.sh @@ -197,7 +197,7 @@ if [[ -t 1 ]]; then fi function restore_ownership { - if ! sudo chown -R "$ORIG_UID_GID" . >/dev/null 2>&1; then + if [[ -n ${EMQX_TEST_DO_NOT_RUN_SUDO+x} ]] || ! sudo chown -R "$ORIG_UID_GID" . >/dev/null 2>&1; then docker exec -i $TTY -u root:root "$ERLANG_CONTAINER" bash -c "chown -R $ORIG_UID_GID /emqx" >/dev/null 2>&1 || true fi }