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
|
||||
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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue