Add a test script that can be run from other repos

This commit is contained in:
Dave Syer
2015-12-18 11:44:46 +00:00
parent 23ba386b19
commit c66ed02286

45
scripts/runTests.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
set -o errexit
REPO_URL="${REPO_URL:-https://github.com/spring-cloud-samples/tests.git}"
REPO_BRANCH="${REPO_BRANCH:-master}"
if [[ -d zuul-config-discovery ]]; then
REPO_LOCAL="${REPO_LOCAL:-.}"
else
REPO_LOCAL="${REPO_LOCAL:-tests}"
fi
WAIT_TIME="${WAIT_TIME:-5}"
RETRIES="${RETRIES:-48}"
DEFAULT_VERSION="${DEFAULT_VERSION:-1.0.0.BUILD-SNAPSHOT}"
# Parse the script arguments
while getopts ":r" opt; do
case $opt in
r)
RESET=0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# Clone or update the repository
if [[ ! -e "${REPO_LOCAL}/.git" ]]; then
git clone "${REPO_URL}" "${REPO_LOCAL}"
cd "${REPO_LOCAL}"
else
cd "${REPO_LOCAL}"
if [[ $RESET ]]; then
git reset --hard
git pull "${REPO_URL}" "${REPO_BRANCH}"
fi
fi
./mvnw --fail-at-end clean package