Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" -a -s "${HS_SUMMARY}/failed-summary.log" ] |
| 4 | then |
| 5 | echo -n "Copying docker logs..." |
| 6 | dirs=$(jq -r '.[0] | .SpecReports[] | select(.State == "failed") | .LeafNodeText' ${HS_SUMMARY}/report.json) |
| 7 | for dirName in $dirs; do |
| 8 | logDir=/tmp/hs-test/$dirName |
| 9 | if [ -d "$logDir" ]; then |
| 10 | mkdir -p $WORKSPACE/archives/summary |
| 11 | cp -r $logDir $WORKSPACE/archives/summary/ |
| 12 | fi |
| 13 | done |
| 14 | echo "Done." |
| 15 | |
| 16 | if [ -n "$WORKSPACE" ] |
| 17 | then |
| 18 | echo -n "Copying failed test logs into build log archive directory ($WORKSPACE/archives)... " |
| 19 | mkdir -p $WORKSPACE/archives/summary |
| 20 | cp -a ${HS_SUMMARY}/* $WORKSPACE/archives/summary |
| 21 | echo "Done." |
| 22 | fi |
| 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." |
| 31 | exit 0 |
| 32 | fi |
| 33 | |
| 34 | exit 1 |