jjb/releng: fix compass-container $DOCKERFILE
[releng.git] / jjb / compass4nfv / compass-logs.sh
1 #!/bin/bash
2 set -o nounset
3 set -o pipefail
4
5 # log info to console
6 echo "Uploading the logs $INSTALLER_TYPE artifact. This could take some time..."
7 echo "--------------------------------------------------------"
8 echo
9
10 # create the log directory if it doesn't exist
11 [[ -d $LOG_DIRECTORY ]] || mkdir -p $LOG_DIRECTORY
12
13 OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
14 COMPASS_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}_${OPNFV_ARTIFACT_VERSION}.log.tar.gz"
15
16
17 sudo docker exec compass-tasks /bin/bash /opt/collect-log.sh
18 sudo docker cp compass-tasks:/opt/log.tar.gz ${LOG_DIRECTORY}/${COMPASS_LOG_FILENAME}
19
20 sudo chown $(whoami):$(whoami) ${LOG_DIRECTORY}/${COMPASS_LOG_FILENAME}
21
22 gsutil cp "${LOG_DIRECTORY}/${COMPASS_LOG_FILENAME}" \
23      "gs://${GS_URL}/logs/${COMPASS_LOG_FILENAME}" > /dev/null 2>&1
24
25 echo
26 echo "--------------------------------------------------------"
27 echo "Done!"
28 echo "Artifact is available as http://${GS_URL}/logs/${COMPASS_LOG_FILENAME}"