Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Adrian Villin | 688ac5a | 2024-05-10 04:19:35 -0400 | [diff] [blame] | 3 | # if failed-summary.log is not empty, exit status = 1 |
| 4 | if [ -s "${HS_ROOT}/summary/failed-summary.log" ] |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 5 | then |
Adrian Villin | 688ac5a | 2024-05-10 04:19:35 -0400 | [diff] [blame] | 6 | if [ -n "${WORKSPACE}" ] |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 7 | then |
Adrian Villin | 688ac5a | 2024-05-10 04:19:35 -0400 | [diff] [blame] | 8 | 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 Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 31 | fi |
Adrian Villin | 6d44aab | 2024-06-26 10:08:47 +0200 | [diff] [blame] | 32 | echo "*************************** SUMMARY ***************************" |
| 33 | cat "${HS_ROOT}/summary/failed-summary.log" |
Adrian Villin | 688ac5a | 2024-05-10 04:19:35 -0400 | [diff] [blame] | 34 | exit 1 |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 35 | fi |