2024-05-06 06:55:34 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-09-25 14:49:11 +02:00
|
|
|
if [ $1 == 2 ]
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-05-10 04:19:35 -04:00
|
|
|
# if failed-summary.log is not empty, exit status = 1
|
|
|
|
if [ -s "${HS_ROOT}/summary/failed-summary.log" ]
|
2024-05-06 06:55:34 -04:00
|
|
|
then
|
2024-05-10 04:19:35 -04:00
|
|
|
if [ -n "${WORKSPACE}" ]
|
2024-05-06 06:55:34 -04:00
|
|
|
then
|
2024-05-10 04:19:35 -04:00
|
|
|
echo -n "Copying docker logs..."
|
2024-10-15 14:56:16 +02:00
|
|
|
dirs=$(jq -r '.[0] | .SpecReports[] | select((.State == "failed") or (.State == "timedout") or (.State == "panicked")) | .LeafNodeText | split("/")[1]' ${HS_ROOT}/summary/report.json)
|
2024-05-10 04:19:35 -04:00
|
|
|
for dirName in $dirs; do
|
|
|
|
logDir=/tmp/hs-test/$dirName
|
|
|
|
if [ -d "$logDir" ]; then
|
|
|
|
mkdir -p ${WORKSPACE}/archives/summary
|
2024-08-20 14:36:12 +02:00
|
|
|
rsync -a --exclude 'volumes' $logDir ${WORKSPACE}/archives/summary/
|
2024-05-10 04:19:35 -04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "Done."
|
2024-05-06 06:55:34 -04:00
|
|
|
|
2024-05-10 04:19:35 -04:00
|
|
|
echo -n "Copying failed test logs into build log archive directory (${WORKSPACE}/archives)... "
|
|
|
|
mkdir -p ${WORKSPACE}/archives/summary
|
|
|
|
cp -a ${HS_ROOT}/summary/* ${WORKSPACE}/archives/summary
|
|
|
|
echo "Done."
|
2024-05-06 06:55:34 -04:00
|
|
|
|
2024-05-10 04:19:35 -04:00
|
|
|
echo -n "Compressing files in ${WORKSPACE}/archives from test runs... "
|
|
|
|
cd ${WORKSPACE}/archives
|
|
|
|
find . -type f \( -name "*.json" -o -name "*.log" \) -exec gzip {} \;
|
|
|
|
echo "Done."
|
2024-05-06 06:55:34 -04:00
|
|
|
|
2024-05-10 04:19:35 -04:00
|
|
|
else
|
|
|
|
echo "Not compressing files in temporary directories from test runs."
|
|
|
|
fi
|
2024-06-26 10:08:47 +02:00
|
|
|
echo "*************************** SUMMARY ***************************"
|
|
|
|
cat "${HS_ROOT}/summary/failed-summary.log"
|
2024-05-10 04:19:35 -04:00
|
|
|
exit 1
|
2024-08-22 10:35:19 +02:00
|
|
|
else
|
|
|
|
exit $1
|
2024-05-10 04:19:35 -04:00
|
|
|
fi
|