-
Notifications
You must be signed in to change notification settings - Fork 14
/
cryo.sh
executable file
·111 lines (93 loc) · 4.03 KB
/
cryo.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
#
#
# Run Cryo: https://github.com/jboss-set/cryo,
# a git bisect implementation based on github pull requests
#
set -eo pipefail
readonly PARENT_JOB_DIR=${PARENT_JOB_DIR:-'/parent_job'}
readonly APHRODITE_CONFIG=${APHRODITE_CONFIG:-'/opt/tools/aphrodite.json'}
readonly MAVEN_LOCAL_REPO=${MAVEN_LOCAL_REPO:-${WORKSPACE}/maven-local-repository}
readonly JQ_DOWNLOAD_URL=${JQ_DOWNLOAD_URL:-'https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64'}
export MEMORY_SETTINGS=${MEMORY_SETTINGS:-'-Xmx2048m -Xms1024m -XX:MaxPermSize=512m'}
export MAVEN_SETTINGS_XML=${MAVEN_SETTINGS_XML:-'/opt/tools/settings.xml'}
export MAVEN_OPTS="${MAVEN_OPTS} ${MEMORY_SETTINGS}"
export MAVEN_OPTS="${MAVEN_OPTS} -Dmaven.wagon.http.ssl.insecure=true -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${MAVEN_LOCAL_REPO}"
export MAVEN_OPTS="${MAVEN_OPTS} -Dskip-download-sources -DskipSources -Dmaven.source.skip -Dsource.skip -Dproject.src.skip"
readonly PARAMS_FILE=${PARAMS_FILE:-${WORKSPACE}/../cryo-params.sh}
if [ -f "${PARAMS_FILE}" ]; then
# shellcheck disable=SC1090
. "${PARAMS_FILE}"
fi
if [ -n "${MAVEN_HOME}" ]; then
export PATH=${MAVEN_HOME}/bin:${PATH}
fi
readonly ARCHIVE_LAST=${ARCHIVE_LAST:-''}
# cryo.jar arguments
readonly INCLUDE_LIST=${INCLUDE_LIST:-''}
readonly EXCLUDE_LIST=${EXCLUDE_LIST:-''}
readonly SUFFIX=${SUFFIX:-'.future'}
readonly DRY_RUN=${DRY_RUN:-'true'}
readonly FLIP=${FLIP:-'true'}
readonly CHECK_STATE=${CHECK_STATE:-''}
readonly FAST_LOGGING=${FAST_LOGGING:-''}
# shellcheck disable=SC2016
readonly MAVEN_ARGS=${MAVEN_ARGS:-"-Dmaven.wagon.http.ssl.insecure=true,-Dhttps.protocols=TLSv1.2,-Dnorpm,-Dskip-download-sources,-DskipSources,-Dmaven.source.skip,-Dsource.skip,-Dproject.src.skip"}
# scripts:
CRYO_COMMAND_ARGS="-o HarmoniaOperationCenter -r ${WORKSPACE}"
if [[ -n "${EXCLUDE_LIST}" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -e ${EXCLUDE_LIST}"
fi
if [[ -n "${INCLUDE_LIST}" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -i ${INCLUDE_LIST}"
fi
if [[ -n "${SUFFIX}" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -s ${SUFFIX}"
fi
if [[ "${DRY_RUN}" != "false" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -d"
fi
if [[ "${FLIP}" = "true" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -f"
fi
if [[ "${FAST_LOGGING}" = "true" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -q"
fi
if [[ "${CHECK_STATE}" = "true" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -c"
fi
if [[ -n "${MAVEN_ARGS}" ]]; then
CRYO_COMMAND_ARGS="${CRYO_COMMAND_ARGS} -m${MAVEN_ARGS}"
fi
# use HarmoniaOperationCenter which requires env.ENV_HARMONIA_BUILD_SH pointing to eap-job/olympus.sh
HARMONIA_HOME="$(cd "${WORKSPACE}/../harmonia" && pwd)"
export ENV_HARMONIA_BUILD_SH=${HARMONIA_HOME}/${CRYO_HARMONIA_SH:-'eap-job/olympus.sh'}
# disable interactive mode in pr-merge
export NO_STOP_BEFORE_MERGE="true"
AUXILIA_HOME="$(cd "${WORKSPACE}/../auxilia" && pwd)"
export PATH=${AUXILIA_HOME}:${PATH}
# hack to download jq which is needed by pr-merge
echo -e "Hacking by downloading jq."
curl -s -L -o "${AUXILIA_HOME}/jq" "${JQ_DOWNLOAD_URL}"
chmod +x "${AUXILIA_HOME}/jq"
CRYO_COMMAND_OPTS="-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
CRYO_COMMAND_OPTS="-Daphrodite.config=${APHRODITE_CONFIG}"
echo "WORKSPACE: ${WORKSPACE}"
echo "HARMONIA_HOME: ${HARMONIA_HOME}"
echo "AUXILIA_HOME: ${AUXILIA_HOME}"
echo "CRYO_COMMAND_ARGS: ${CRYO_COMMAND_ARGS}"
echo "CRYO_COMMAND_OPTS: ${CRYO_COMMAND_OPTS}"
# shellcheck disable=SC2102
CRYO_JAR="$(ls "${PARENT_JOB_DIR}"/target/cryo-*[^sources].jar)"
echo "CRYO_JAR: ${CRYO_JAR}"
# do not zip workspace.zip when running eap-job/olympus.sh
unset ZIP_WORKSPACE
# shellcheck disable=SC2086
java ${CRYO_COMMAND_OPTS} -jar "${CRYO_JAR}" ${CRYO_COMMAND_ARGS}
#Create archive to avoid default excludes. Cleanup, tar and compress in place
mvn clean -q -DallTests
if [[ -n "${ARCHIVE_LAST}" ]]; then
EAP_FILE_ARCHIVE="eap_$(git rev-parse --abbrev-ref HEAD).tar.gz"
touch "${EAP_FILE_ARCHIVE}"
tar -czf "${EAP_FILE_ARCHIVE}" --exclude="${EAP_FILE_ARCHIVE}" --exclude="workspace.zip" .
fi