hs-test: output docker build command for ci console log
[vpp.git] / extras / hs-test / script / compress.sh
1 #!/usr/bin/env bash
2
3 # if failed-summary.log is not empty, exit status = 1
4 if [ -s "${HS_ROOT}/summary/failed-summary.log" ]
5 then
6     if [ -n "${WORKSPACE}" ]
7     then
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."
31     fi
32     exit 1
33 fi