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 ##############################################################################
14 BIFROST_CONSOLE_LOG="${BUILD_URL}/consoleText"
15 BIFROST_GS_URL=${BIFROST_LOG_URL/http:/gs:}
16 BIFROST_COMPRESS_SUFFIX="tar.gz"
17 BIFROST_COMPRESSED_LOGS=()
19 echo "Uploading build logs to ${BIFROST_LOG_URL}"
21 echo "Uploading console output"
22 curl -L ${BIFROST_CONSOLE_LOG} | gsutil cp - ${BIFROST_GS_URL}/build_log.txt
24 [[ ! -d ${WORKSPACE}/logs ]] && exit 0
26 pushd ${WORKSPACE}/logs/ &> /dev/null
28 echo "Compressing and uploading $x"
29 tar -czf - $x | gsutil cp - ${BIFROST_GS_URL}/${x}.${BIFROST_COMPRESS_SUFFIX} 1>/dev/null
30 BIFROST_COMPRESSED_LOGS+=(${x}.${BIFROST_COMPRESS_SUFFIX})
34 echo "Generating the landing page"
35 cat > index.html << EOF
37 <h1>Build results for <a href=https://$GERRIT_NAME/#/c/$GERRIT_CHANGE_NUMBER>$GERRIT_NAME/$GERRIT_CHANGE_NUMBER</a></h1>
38 <h2>Job: $JOB_NAME</h2>
40 <li><a href=${BIFROST_LOG_URL}/build_log.txt>build_log.txt</a></li>
43 for x in ${BIFROST_COMPRESSED_LOGS[@]}; do
44 echo "<li><a href=${BIFROST_LOG_URL}/${x}>${x}</a></li>" >> index.html
47 cat >> index.html << EOF
52 gsutil cp index.html ${BIFROST_GS_URL}/index.html