From 9383ba7cc2e326fd672a477f95a63f20c10d1be6 Mon Sep 17 00:00:00 2001 From: wutianwei Date: Tue, 30 Jan 2018 16:11:29 +0800 Subject: [Compass4nfv] collect the logs and upload to artifact JIRA: COMPASS-579 Add a job to collect log and upload. what the job do 1. run collect-log.sh to get log from rsyslog container 2. copy log.tar.gz from compass-tasks to jumphost 3. upload the log.tar.gz to artifact Change-Id: Ic2244e33e7ae4b7aa71e15af741191c850982053 Signed-off-by: wutianwei --- jjb/compass4nfv/compass-logs.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 jjb/compass4nfv/compass-logs.sh (limited to 'jjb/compass4nfv/compass-logs.sh') diff --git a/jjb/compass4nfv/compass-logs.sh b/jjb/compass4nfv/compass-logs.sh new file mode 100644 index 000000000..03c8b20ac --- /dev/null +++ b/jjb/compass4nfv/compass-logs.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -o nounset +set -o pipefail + +# log info to console +echo "Uploading the logs $INSTALLER_TYPE artifact. This could take some time..." +echo "--------------------------------------------------------" +echo + +# create the log directory if it doesn't exist +[[ -d $LOG_DIRECTORY ]] || mkdir -p $LOG_DIRECTORY + +OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S") +COMPASS_LOG_FILENAME="${JOB_NAME}_${BUILD_NUMBER}_${OPNFV_ARTIFACT_VERSION}.log.tar.gz" + + +sudo docker exec -it compass-tasks /bin/bash /opt/collect-log.sh +sudo docker cp compass-tasks:/opt/log.tar.gz ${LOG_DIRECTORY}/${COMPASS_LOG_FILENAME} + +sudo chown $(whoami):$(whoami) ${LOG_DIRECTORY}/${COMPASS_LOG_FILENAME} + +gsutil cp "${LOG_DIRECTORY}/${COMPASS_LOG_FILENAME}" \ + "gs://${GS_URL}/logs/${COMPASS_LOG_FILENAME}" > /dev/null 2>&1 + +echo +echo "--------------------------------------------------------" +echo "Done!" +echo "Artifact is available as http://${GS_URL}/logs/${COMPASS_LOG_FILENAME}" -- cgit 1.2.3-korg