Jerry Flood | 4345ded | 2017-03-22 15:30:25 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | ################################################################################################## |
| 3 | # This shell is designed to support retrieval of application debugging data in the case of |
| 4 | # an ETE test failure. This script, along with the gather_application_data.sh will be installed |
| 5 | # in /opt on each of the ONAP VMs. The gather_application_data function is designed by each |
| 6 | # application to gather the relevant debugging data into the current working directory |
| 7 | # to be zipped up and transferred to the Robot VM and ultimately, posted in the failed Jenkins |
| 8 | # job. |
| 9 | ################################################################################################## |
| 10 | |
| 11 | JOB_NUMBER=$2 |
| 12 | APPLICATION=$1 |
| 13 | if [ "$JOB_NUMBER" == '' ];then |
| 14 | JOB_NUMBER=0 |
| 15 | fi |
| 16 | if [ "$APPLICATION" == '' ];then |
| 17 | APPLICATION='job' |
| 18 | fi |
| 19 | |
| 20 | if [ -e /opt/gather_application_data.sh ]; then |
| 21 | source /opt/gather_application_data.sh |
| 22 | else |
| 23 | >&2 echo "${APPLICATION} No gather_application_data function" |
| 24 | exit |
| 25 | fi |
| 26 | |
| 27 | |
| 28 | FOLDER=/tmp/gather_data/${APPLICATION}_${JOB_NUMBER} |
| 29 | mkdir -p $FOLDER |
| 30 | |
| 31 | cd ${FOLDER} |
| 32 | |
| 33 | gather_application_data |
| 34 | |
| 35 | cd ../ |
| 36 | tar --remove-files -cvzf ${APPLICATION}_${JOB_NUMBER}.tar.gz ${APPLICATION}_${JOB_NUMBER} |