fa31f2bcf97f192cfad373a1a42c0e56cb93ac7e
[releng/global-jjb.git] / shell / logs-deploy.sh
1 #!/bin/bash
2 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> logs-deploy.sh"
12
13 # Ensure we fail the job if any steps fail.
14 set -eu -o pipefail
15
16 set -x  # Trace commands for this script to make debugging easier.
17
18 LOGS_SERVER="${LOGS_SERVER:-None}"
19
20 if [ "${LOGS_SERVER}" == 'None' ]
21 then
22     set +x # Disable trace since we no longer need it
23
24     echo "WARNING: Logging server not set"
25 else
26     NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
27     NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
28     BUILD_URL="${BUILD_URL}"
29
30     lftools deploy archives "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
31     lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
32
33     set +x  # Disable trace since we no longer need it.
34
35     echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
36 fi