-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrun
executable file
·68 lines (59 loc) · 1.52 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
#!/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 " -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 " pepperReport Generate a pepper report"
exit 2
}
OSVERSION=7
PARSED=$(getopt -n run -o o: --long osversion:,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
;;
-h | --help)
print_help
;;
--) shift; break ;;
*) echo "run: invalid option: ${1}"; print_help ;;
esac
done
if [[ "${1}" == "" ]]; then
echo "COMMAND required"; print_help
fi
OS_ADDON=""
if [[ "${OSVERSION}" == "8" ]]; then
OS_ADDON="env DOCKERIZED_BUILD_ENV=centos8 "
fi
if [[ "${1^^}" =~ ^(BUILD|UNITTEST|PEPPERREPORT|SMOKETEST)$ ]]; then
echo "run: RHEL${OSVERSION} - running ${1}..."
case "${1^^}" in
BUILD) ${OS_ADDON}./gradlew build ;;
UNITTEST) ${OS_ADDON}./gradlew runPyTest ;;
PEPPERREPORT) ${OS_ADDON}./gradlew generatePepperReport ;;
SMOKETEST) ${OS_ADDON}./gradlew runSmokeTest ;;
esac
else
echo "run: invalid command '${1}'"; print_help
fi