-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathrun
executable file
·86 lines (75 loc) · 2.02 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
print_help() {
echo "Usage: run COMMAND [options]"
echo
echo "Options:"
echo " -o, --osversion [7|8] The RHEL version to build against. Default is 7."
echo " -s, --salt RABBITMQ_SALT The salt used for RabbitMQ passwords"
echo " -h, --help Print this help message."
echo
echo "COMMANDs:"
echo " build Build the connector"
echo " unitTest Run the unit tests"
echo " smokeTest Run the smoke tests"
echo " regressionTest Run the regression tests"
echo " codeReport Generate a code report"
exit 2
}
OSVERSION=7
RABBITMQ_SALT=unset
PARSED=$(getopt -n run -o o:s:h --longoptions osversion:,salt:,help -- "$@")
if [ "${?}" != "0" ]; then
print_help
fi
eval set -- "$PARSED"
while :
do
case "$1" in
-o | --osversion)
if [[ "${2}" =~ ^(7|8)$ ]]; then
OSVERSION="${2}"
shift 2
else
echo "run: invalid value for '${1}': ${2}"
echo
print_help
fi
;;
-s | --salt)
RABBITMQ_SALT=${2}
shift 2
;;
-h | --help)
print_help
;;
--) shift; break ;;
*) echo "run: invalid option: ${1}"; print_help ;;
esac
done
if [[ "${1}" == "" ]]; then
echo "COMMAND required"; print_help
fi
if [[ "${RABBITMQ_SALT}" == "" ]]; then
echo "RabbitMQ salt required"; print_help
fi
OS_ADDON=""
if [[ "${OSVERSION}" == "8" ]]; then
OS_ADDON="env DOCKERIZED_BUILD_ENV=centos8 "
fi
if [[ "${OS_ADDON}" == "" ]]; then
OS_ADDON="env RABBITMQ_SALT=${RABBITMQ_SALT} "
else
OS_ADDON+="RABBITMQ_SALT=${RABBITMQ_SALT} "
fi
if [[ "${1^^}" =~ ^(BUILD|UNITTEST|CODEREPORT|SMOKETEST|REGRESSIONTEST)$ ]]; then
echo "run: RHEL${OSVERSION} - running ${1}..."
case "${1^^}" in
BUILD) ${OS_ADDON}./gradlew build ;;
UNITTEST) ${OS_ADDON}./gradlew runUnitTests ;;
CODEREPORT) ${OS_ADDON}./gradlew criticizeCode ;;
SMOKETEST) ${OS_ADDON}./gradlew runSmokeTest ;;
REGRESSIONTEST) ${OS_ADDON}./gradlew runRegressionTest ;;
esac
else
echo "run: invalid command '${1}'"; print_help
fi