blob: c6b23cf9bdd6444d3e68bc0ffa858fda7ddc5a47 [file] [log] [blame]
Adrian Villin637edda2024-05-06 06:55:34 -04001#!/usr/bin/env bash
2
Adrian Villin688ac5a2024-05-10 04:19:35 -04003# if failed-summary.log is not empty, exit status = 1
4if [ -s "${HS_ROOT}/summary/failed-summary.log" ]
Adrian Villin637edda2024-05-06 06:55:34 -04005then
Adrian Villin688ac5a2024-05-10 04:19:35 -04006 if [ -n "${WORKSPACE}" ]
Adrian Villin637edda2024-05-06 06:55:34 -04007 then
Adrian Villin688ac5a2024-05-10 04:19:35 -04008 echo -n "Copying docker logs..."
9 dirs=$(jq -r '.[0] | .SpecReports[] | select(.State == "failed") | .LeafNodeText' ${HS_ROOT}/summary/report.json)
10 for dirName in $dirs; do
11 logDir=/tmp/hs-test/$dirName
12 if [ -d "$logDir" ]; then
13 mkdir -p ${WORKSPACE}/archives/summary
14 cp -r $logDir ${WORKSPACE}/archives/summary/
15 fi
16 done
17 echo "Done."
18
19 echo -n "Copying failed test logs into build log archive directory (${WORKSPACE}/archives)... "
20 mkdir -p ${WORKSPACE}/archives/summary
21 cp -a ${HS_ROOT}/summary/* ${WORKSPACE}/archives/summary
22 echo "Done."
23
24 echo -n "Compressing files in ${WORKSPACE}/archives from test runs... "
25 cd ${WORKSPACE}/archives
26 find . -type f \( -name "*.json" -o -name "*.log" \) -exec gzip {} \;
27 echo "Done."
28
29 else
30 echo "Not compressing files in temporary directories from test runs."
Adrian Villin637edda2024-05-06 06:55:34 -040031 fi
Adrian Villin6d44aab2024-06-26 10:08:47 +020032 echo "*************************** SUMMARY ***************************"
33 cat "${HS_ROOT}/summary/failed-summary.log"
Adrian Villin688ac5a2024-05-10 04:19:35 -040034 exit 1
Adrian Villin637edda2024-05-06 06:55:34 -040035fi