-
Notifications
You must be signed in to change notification settings - Fork 14
/
pr-processor.sh
executable file
·66 lines (52 loc) · 1.88 KB
/
pr-processor.sh
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
#!/bin/bash
set -eo pipefail
readonly PULL_REQUEST_PROCESSOR_HOME=${PULL_REQUEST_PROCESSOR_HOME}
readonly APHRODITE_CONFIG=${APHRODITE_CONFIG:-'/opt/tools/aphrodite.json'}
readonly PATH_TO_JAR=${PATH_TO_JAR:-"${PULL_REQUEST_PROCESSOR_HOME}/pull-processor-${VERSION}.jar"}
readonly PR_PROCESSOR_WRITE_MODE=${PR_PROCESSOR_WRITE_MODE:-'true'}
readonly PR_PROCESSOR_HTML_REPORT="${WORKSPACE}/report.html"
readonly CACHE_NAME=${CACHE_NAME:-'github-cache'}
readonly CACHE_SIZE=${CACHE_SIZE:-'20'}
readonly PATH=${JAVA_HOME}/bin:${PATH}
declare -a ACTIVES_STREAMS
ACTIVES_STREAMS[0]='jboss-eap-7.4.z[wildfly-wildfly,wildfly-wildfly-core]'
ACTIVES_STREAMS[1]='jboss-eap-8.0.z[wildfly-wildfly,wildfly-wildfly-core]'
set -u
if [ -z "${PULL_REQUEST_PROCESSOR_HOME}" ]; then
echo "PULL_REQUEST_PROCESSOR_HOME is not defined - abort."
exit 1
fi
if [ ! -d "${PULL_REQUEST_PROCESSOR_HOME}" ]; then
echo "PULL_REQUEST_PROCESSOR_HOME is not a directory (${PULL_REQUEST_PROCESSOR_HOME}) - abort."
exit 2
fi
if [ -z "${APHRODITE_CONFIG}" ]; then
echo "APHRODITE_CONFIG is not defined - abort."
exit 3
fi
if [ ! -e "${APHRODITE_CONFIG}" ]; then
echo "APHRODITE_CONFIG does not exist (${APHRODITE_CONFIG}) abort."
exit 4
fi
if [ -d "${APHRODITE_CONFIG}" ]; then
echo "APHRODITE_CONFIG is a directory: ${APHRODITE_CONFIG} - abort."
exit 5
fi
if [ ! -e "${PATH_TO_JAR}" ]; then
echo "Missing Pull Processor JAR (${PATH_TO_JAR}) - abort."
exit 6
fi
if [ -z "${JAVA_HOME}" ]; then
echo "No JAVA_HOME has been defined - abort"
exit 7
fi
java -jar \
-Daphrodite.config="${APHRODITE_CONFIG}" \
-DcacheDir="${PULL_REQUEST_PROCESSOR_HOME}/cache" \
-DcacheName="${CACHE_NAME}" \
-DcacheSize="${CACHE_SIZE}" \
"${PATH_TO_JAR}" \
-s "${ACTIVES_STREAMS[@]}" \
-p "${ACTIVES_STREAMS[@]}" \
-f "${PR_PROCESSOR_HTML_REPORT}" \
-w "${PR_PROCESSOR_WRITE_MODE}"