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@64bd740295
This commit is contained in:
parent
1fea75cc4f
commit
589e880a9c
20
dev-tools/ci
20
dev-tools/ci
|
@ -13,24 +13,24 @@
|
||||||
|
|
||||||
# Turn on semi-strict mode
|
# Turn on semi-strict mode
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
if [ -n "$BASH" ]; then
|
||||||
|
set -o pipefail
|
||||||
# Set default test scenario, equivalent to passing the cli arg `tests`
|
fi
|
||||||
GRADLE_OPT_STRING="--info check -Dtests.network=true -Dtests.badapples=true"
|
|
||||||
|
|
||||||
# Allow the user choose different test through a single cli arg
|
# Allow the user choose different test through a single cli arg
|
||||||
if [ $# -ge 1 ]
|
# default to `check` if no argument has been supplied
|
||||||
then
|
key=${1-check}
|
||||||
key="$1"
|
|
||||||
case $key in
|
case $key in
|
||||||
packagingtests)
|
packagingTest)
|
||||||
GRADLE_OPT_STRING="--info -Pvagrant.boxes=all :x-plugins:qa:vagrant:packagingTest"
|
GRADLE_OPT_STRING="--info -Pvagrant.boxes=all :x-plugins:qa:vagrant:packagingTest"
|
||||||
break;;
|
break;;
|
||||||
tests)
|
check)
|
||||||
GRADLE_OPT_STRING="--info check -Dtests.network=true -Dtests.badapples=true"
|
GRADLE_OPT_STRING="--info check -Dtests.network=true -Dtests.badapples=true"
|
||||||
break;;
|
break;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported cli argument $1. Allowed parameters are packagingTest or check. No argument defaults to check."
|
||||||
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
SCRIPT="$0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue