summaryrefslogtreecommitdiffstats
path: root/jjb/compass4nfv/compass-logs.sh
blob: 03c8b20ac7755f6829736cbbe75e2b9675257755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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}"