diff --git a/scripts/checkdocker.sh b/scripts/checkdocker.sh deleted file mode 100644 index 10ac50e9..00000000 --- a/scripts/checkdocker.sh +++ /dev/null @@ -1,7 +0,0 @@ -# The Docker CLI does not need to be run as root in order to be safe in all -# cases. For example, when running on MacOS it is quarantined to a different -# virtual machine. If you are running daemon on a local machine then practice -# caution with sudo-less docker invocations. -user_can_docker() { - ! docker info 2>&1 | grep -q "permission denied" -} diff --git a/scripts/start-docker b/scripts/start-docker index 3f225ef6..7146059a 100755 --- a/scripts/start-docker +++ b/scripts/start-docker @@ -4,9 +4,11 @@ set -euo pipefail RELEASE_PATH="$(cd "$(dirname "$0")/.." && pwd)" export RELEASE_PATH -. "${RELEASE_PATH}/scripts/checkdocker.sh" - -if user_can_docker; then +# The Docker CLI does not need to be run as root in order to be safe in all +# cases. For example, when running on MacOS it is quarantined to a different +# virtual machine. If you are running daemon on a local machine then practice +# caution with sudo-less docker invocations. +if ! docker info 2>&1 | grep -q "permission denied"; then DOCKER="docker" else # On development workstations docker must run as root. @@ -19,4 +21,4 @@ $DOCKER run \ --privileged \ -v "${RELEASE_PATH}:/bpm" \ -it cfbpm/bpm-ci:latest \ - /bin/bash + "${@:-/bin/bash}" diff --git a/scripts/test-with-docker b/scripts/test-with-docker index 196335a4..1405cb4a 100755 --- a/scripts/test-with-docker +++ b/scripts/test-with-docker @@ -4,20 +4,4 @@ set -euo pipefail RELEASE_PATH="$(cd "$(dirname "$0")/.." && pwd)" export RELEASE_PATH -. "${RELEASE_PATH}/scripts/checkdocker.sh" - -if user_can_docker; then - DOCKER="docker" -else - # On development workstations docker must run as root. - # These settings are not related to the privileges that bpm creates runc containers with. - DOCKER="sudo docker" -fi - -$DOCKER pull cfbpm/bpm-ci:latest - -$DOCKER run \ - --privileged \ - -v "${RELEASE_PATH}:/bpm" \ - -t cfbpm/bpm-ci:latest \ - /bpm/scripts/test-unit "$@" +"${RELEASE_PATH}/scripts/start-docker" /bpm/scripts/test-unit