2024-05-06 06:55:34 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
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..."
|
|
|
|
|
dirs=$(jq -r '.[0] | .SpecReports[] | select(.State == "failed") | .LeafNodeText' ${HS_ROOT}/summary/report.json)
|
|
|
|
|
for dirName in $dirs; do
|
|
|
|
|
logDir=/tmp/hs-test/$dirName
|
|
|
|
|
if [ -d "$logDir" ]; then
|
|
|
|
|
mkdir -p ${WORKSPACE}/archives/summary
|
|
|
|
|
cp -r $logDir ${WORKSPACE}/archives/summary/
|
|
|
|
|
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
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|