2018-10-16 13:07:38 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-01-09 17:30:22 +02:00
|
|
|
d=$(dirname "$0")
|
|
|
|
[ ! -z "$d" ] && d="$d/"
|
|
|
|
|
2019-05-21 12:45:46 +02:00
|
|
|
WS_OUT="$(pwd)/documentation/jenkins_workspace"
|
2019-05-21 12:32:49 +02:00
|
|
|
WS_IN=/workspace
|
|
|
|
|
2019-05-21 14:01:43 +02:00
|
|
|
STEP_CALL_MAPPING_FILE_NAME=step_calls_mapping.json
|
|
|
|
PLUGIN_MAPPING_FILE_NAME=plugin_mapping.json
|
2019-05-21 12:32:49 +02:00
|
|
|
|
2019-05-21 14:01:43 +02:00
|
|
|
CALLS="${WS_OUT}/${STEP_CALL_MAPPING_FILE_NAME}"
|
|
|
|
PLUGIN_MAPPING="${WS_OUT}/${PLUGIN_MAPPING_FILE_NAME}"
|
2019-05-21 12:32:49 +02:00
|
|
|
|
2019-05-21 14:01:43 +02:00
|
|
|
for f in ${CALLS} ${PLUGIN_MAPPING}
|
2019-05-21 12:32:49 +02:00
|
|
|
do
|
|
|
|
[ -e "${f}" ] && rm -rf "${f}"
|
|
|
|
done
|
|
|
|
|
2019-05-21 13:59:40 +02:00
|
|
|
export CLASSPATH_FILE='target/cp.txt'
|
2020-04-17 17:44:31 +02:00
|
|
|
mvn --batch-mode --show-version clean test dependency:build-classpath -Dmdep.outputFile=${CLASSPATH_FILE}
|
2020-03-31 12:24:14 +02:00
|
|
|
|
|
|
|
if [ "$?" != "0" ];then
|
|
|
|
echo "[ERROR] maven test / build-classpath failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "${CLASSPATH_FILE}" ];then
|
|
|
|
echo "[ERROR] Classpath file required for docu generation does not exist"
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-05-21 13:59:40 +02:00
|
|
|
|
|
|
|
# --in: is created by the unit tests. It contains a mapping between the test case (name is
|
|
|
|
# already adjusted).
|
|
|
|
# --out: Contains a transformed version. The calls to other pipeline steps are resolved in a
|
|
|
|
# transitive manner. This allows us to report all Jenkins plugin calls (also the calls which
|
|
|
|
# are performed by other pipeline steps. E.g.: each step includes basically a call to
|
|
|
|
# handlePipelineStepErrors. The Plugin calls issues by handlePipelineStepErrors are also
|
|
|
|
# reported for the step calling that auxiliar step).
|
2019-05-21 14:41:23 +02:00
|
|
|
groovy "${d}resolveTransitiveCalls" -in target/trackedCalls.json --out "${CALLS}"
|
2019-05-21 12:32:49 +02:00
|
|
|
|
|
|
|
[ -f "${CALLS}" ] || { echo "File \"${CALLS}\" does not exist." ; exit 1; }
|
|
|
|
|
|
|
|
docker run \
|
|
|
|
-w "${WS_IN}" \
|
2019-05-21 14:01:43 +02:00
|
|
|
--env calls="${WS_IN}/${STEP_CALL_MAPPING_FILE_NAME}" \
|
|
|
|
--env result="${WS_IN}/${PLUGIN_MAPPING_FILE_NAME}" \
|
2019-05-21 12:32:49 +02:00
|
|
|
-v "${WS_OUT}:${WS_IN}" \
|
|
|
|
ppiper/jenkinsfile-runner \
|
|
|
|
-ns \
|
|
|
|
-f Jenkinsfile \
|
|
|
|
--runWorkspace /workspace
|
|
|
|
|
2019-05-21 14:01:43 +02:00
|
|
|
[ -f "${PLUGIN_MAPPING}" ] || { echo "Result file containing step to plugin mapping not found (${PLUGIN_MAPPING})."; exit 1; }
|
2019-05-21 12:32:49 +02:00
|
|
|
|
2019-01-11 15:21:00 +02:00
|
|
|
groovy -cp "target/classes:$(cat $CLASSPATH_FILE)" "${d}createDocu" "${@}"
|