From 589e880a9c5750c160f0c936aae1d55003a4c605 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Mon, 28 Nov 2016 13:19:48 +0200 Subject: [PATCH] Make cli arg parsing compliant with requirements. Remove duplicate definition of GRADLE_OPT_TEST and rename arguments as discussed in https://github.com/elastic/x-plugins/pull/4137#discussion_r89660620 Default to `check` if no argument is passed, but exit with error in an unsupported parameter is provided. Also ensure the pipefail option is only set when the executing shell is *really* bash as opposed to POSIX sh which doesn't support it. Original commit: elastic/x-pack-elasticsearch@64bd740295ef56639909b1103cad9be3d68f8271 --- dev-tools/ci | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dev-tools/ci b/dev-tools/ci index f81cf95e483..765d9a8bd0b 100755 --- a/dev-tools/ci +++ b/dev-tools/ci @@ -13,24 +13,24 @@ # Turn on semi-strict mode set -e -set -o pipefail - -# Set default test scenario, equivalent to passing the cli arg `tests` -GRADLE_OPT_STRING="--info check -Dtests.network=true -Dtests.badapples=true" +if [ -n "$BASH" ]; then + set -o pipefail +fi # Allow the user choose different test through a single cli arg -if [ $# -ge 1 ] -then -key="$1" +# default to `check` if no argument has been supplied +key=${1-check} case $key in - packagingtests) + packagingTest) GRADLE_OPT_STRING="--info -Pvagrant.boxes=all :x-plugins:qa:vagrant:packagingTest" break;; - tests) + check) GRADLE_OPT_STRING="--info check -Dtests.network=true -Dtests.badapples=true" break;; + *) + echo "Unsupported cli argument $1. Allowed parameters are packagingTest or check. No argument defaults to check." + exit 1;; esac -fi SCRIPT="$0"