From 5df83713c9a978e7a4d1d65ce9377a8ffbf525d0 Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Mon, 24 Apr 2017 08:27:23 -0700 Subject: [PATCH] Only ship logs if LOGS_SERVER defined When new projects are first being stood up they don't always have the ability to pull their console logs since Jenkins may be in a locked down mode. If this is the case then the log shipping will always fail and cause the job to be marked as either FAILED or UNSTABLE. Instead we should only ship the logs if LOGS_SERVER is defined in Jenkins flagging that the console logs are publicly available. Change-Id: I6fc162fec2d7c0cdc1a3785a8ec726d2430d5c96 Signed-off-by: Andrew Grimberg --- shell/logs-deploy.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/shell/logs-deploy.sh b/shell/logs-deploy.sh index 222bb7f1..e5c990a4 100644 --- a/shell/logs-deploy.sh +++ b/shell/logs-deploy.sh @@ -11,14 +11,22 @@ set -x # Trace commands for this script to make debugging easier. -LOGS_SERVER="${LOGS_SERVER:-WARNING: Logging Server Not Set.}" -NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}" -NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}" -BUILD_URL="${BUILD_URL}" +LOGS_SERVER="${LOGS_SERVER:-None}" -lftools deploy archives "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE" -lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL" +if [ "${LOGS_SERVER}" == 'None' ] +then + set +x # Disable trace since we no longer need it -set +x # Disable trace since we no longer need it. + echo "WARNING: Logging server not set" +else + NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}" + NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}" + BUILD_URL="${BUILD_URL}" -echo "Build logs: $LOGS_SERVER/$NEXUS_PATH" + lftools deploy archives "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE" + lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL" + + set +x # Disable trace since we no longer need it. + + echo "Build logs: $LOGS_SERVER/$NEXUS_PATH" +fi -- 2.16.6