From 56be321004d4c8d5754ce57003083d2f9faf0ccb Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Thu, 5 Apr 2018 10:45:25 -0400 Subject: Apex: Enable overcloud log collection With this commit: https://gerrit.opnfv.org/gerrit/#/c/47875/ We can now gather logs from after at the end of a deploy/test job and upload them to artifacts. This patch enables that behavior on verify and daily jobs. Change-Id: If7af4cf1363e4bbcee78d98850af7c0e20250f3f Signed-off-by: Tim Rozet --- jjb/apex/apex-fetch-logs.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 jjb/apex/apex-fetch-logs.sh (limited to 'jjb/apex/apex-fetch-logs.sh') diff --git a/jjb/apex/apex-fetch-logs.sh b/jjb/apex/apex-fetch-logs.sh new file mode 100755 index 000000000..f25f456b1 --- /dev/null +++ b/jjb/apex/apex-fetch-logs.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -o errexit +set -o nounset +set -o pipefail + +# log info to console +echo "Fetching logs from overcloud. This could take some time..." +echo "--------------------------------------------------------" +echo + +if sudo opnfv-pyutil --fetch-logs; then + LOG_LOCATION=$(cat apex_util.log | grep 'Log retrieval complete' | grep -Eo '/tmp/.+$') + if [ -z "$LOG_LOCATION" ]; then + echo "WARNING: Unable to determine log location. Logs will not be uploaded" + exit 0 + else + UPLOAD_LOCATION="${GS_URL}/logs/${JOB_NAME}/${BUILD_NUMBER}/" + gsutil cp -r ${LOG_LOCATION} gs://${UPLOAD_LOCATION} > gsutil.latest_logs.log + echo "Logs available at https://${UPLOAD_LOCATION}/$(basename $LOG_LOCATION)" + fi +else + echo "WARNING: Log retrieval failed. No logs will be uploaded" + exit 0 +fi -- cgit 1.2.3-korg