From 30a37511e298847801866de9b4e54c9e658114c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Mon, 5 Mar 2018 14:30:30 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9D=87=EF=B8=8F=20Adds=20DEBUG=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-latest.sh | 6 +++++- build.sh | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build-latest.sh b/build-latest.sh index 8d9121a..3a82577 100755 --- a/build-latest.sh +++ b/build-latest.sh @@ -27,8 +27,12 @@ if [ "${PRERELEASE}" == "true" ]; then if ( [ "$MAJOR_STABLE" -eq "$MAJOR_UNSTABLE" ] && [ "$MINOR_STABLE" -ge "$MINOR_UNSTABLE" ] ) \ || [ "$MAJOR_STABLE" -gt "$MAJOR_UNSTABLE" ]; then - exit 0 echo "❎ Latest unstable version ('$VERSION') is not higher than the latest stable version ('$STABLE_VERSION')." + if [ -z "$DEBUG" ]; then + exit 0 + else + echo "⚠️ Would exit here with code '0', but DEBUG is enabled." + fi fi fi diff --git a/build.sh b/build.sh index 2853417..43df0b6 100755 --- a/build.sh +++ b/build.sh @@ -9,6 +9,8 @@ if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then echo " --push Pushes built Docker image to docker hub." echo "" echo "You can use the following ENV variables to customize the build:" + echo " DEBUG If defined, the script does not stop when certain checks are unsatisfied." + echo " DRY_RUN Prints all build statements instead of running them." echo " DOCKER_OPTS Add parameters to Docker." echo " Default:" echo " When starts with 'v': \"\"" @@ -86,9 +88,16 @@ if [ -z "$VARIANT" ]; then else DOCKERFILE="Dockerfile.${VARIANT}" DOCKER_TAG="${DOCKER_TAG}-${VARIANT}" - if [ ! -f ${DOCKERFILE} ]; then - echo "The Dockerfile ${DOCKERFILE} for variant '${VARIANT}' doesn't exist. Exiting" - exit 1 + + # Fail fast + if [ ! -f "${DOCKERFILE}" ]; then + echo "🚨 The Dockerfile ${DOCKERFILE} for variant '${VARIANT}' doesn't exist." + + if [ -z "$DEBUG" ]; then + exit 1 + else + echo "⚠️ Would exit here with code '1', but DEBUG is enabled." + fi fi fi