Only ship logs if LOGS_SERVER defined
[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
12 set -x  # Trace commands for this script to make debugging easier.
13
14 LOGS_SERVER="${LOGS_SERVER:-None}"
15
16 if [ "${LOGS_SERVER}" == 'None' ]
17 then
18     set +x # Disable trace since we no longer need it
19
20     echo "WARNING: Logging server not set"
21 else
22     NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
23     NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
24     BUILD_URL="${BUILD_URL}"
25
26     lftools deploy archives "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
27     lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
28
29     set +x  # Disable trace since we no longer need it.
30
31     echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
32 fi