From: Andrew Grimberg Date: Mon, 24 Apr 2017 15:27:23 +0000 (-0700) Subject: Only ship logs if LOGS_SERVER defined X-Git-Tag: v0.2.0~3 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F4505%2F3;p=releng%2Fglobal-jjb.git 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 --- 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