infra: bifrost: Upload build logs to artifacts.opnfv.org
[releng.git] / jjb / infra / bifrost-upload-logs.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 SUSE.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -eu
12 set -o pipefail
13
14 BIFROST_CONSOLE_LOG="${BUILD_URL}/consoleText"
15 BIFROST_GS_URL=${BIFROST_GS_STORAGE/http:/gs:}
16
17 echo "Uploading build logs to ${BIFROST_LOG_URL}"
18
19 echo "Uploading console output"
20 curl -L ${BIFROST_CONSOLE_LOG} | gsutil cp - ${BIFROST_GS_URL}/console.txt
21
22 [[ ! -d ${WORKSPACE}/logs ]] && exit 0
23
24 pushd ${WORKSPACE}/logs/ &> /dev/null
25 for x in *.log; do
26     echo "Compressing and uploading $x"
27     tar -czf - $x | gsutil cp - ${BIFROST_GS_URL}/$x.tar.gz
28 done
29 popd ${WORKSPACE}/logs &> /dev/null