From: Houa Yang Date: Tue, 1 Oct 2019 20:06:03 +0000 (-0500) Subject: Add conditional block for s3 X-Git-Tag: v0.52.0~12^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F61890%2F7;p=releng%2Fglobal-jjb.git Add conditional block for s3 Add conditional block for log shipping via AWS s3. This will need some sort of environment variable, so the build will know to also ship logs to s3. Issue-Id: RELENG-2379, RELENG-2380 Signed-off-by: Houa Yang Change-Id: Iff922d22e3ffafb068ce7053194f8b7d289111b8 --- diff --git a/shell/logs-deploy.sh b/shell/logs-deploy.sh index 44ec180f..633aae86 100644 --- a/shell/logs-deploy.sh +++ b/shell/logs-deploy.sh @@ -14,8 +14,8 @@ echo "---> logs-deploy.sh" # Disable 'globbing' set -euf -o pipefail -if [[ -z $"${LOGS_SERVER:-}" ]]; then - echo "WARNING: Logging server not set" +if [[ -z ${LOGS_SERVER:-} ]]; then + echo "WARNING: Nexus logging server not set" else nexus_url="${NEXUSPROXY:-$NEXUS_URL}" nexus_path="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}" @@ -40,3 +40,20 @@ else echo "Build logs: $LOGS_SERVER/$nexus_path" fi + +if [[ -z ${S3_BUCKET:-} ]]; then + echo "WARNING: S3 logging server not set" +else + s3_path="$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER" + echo "INFO: S3 path $s3_path" + + pattern_opts=() + for arg in $ARCHIVE_ARTIFACTS; do + pattern_opts+=("-p" "$arg") + done + lftools deploy s3 "${pattern_opts[@]}" "$S3_BUCKET" "$s3_path" \ + "$BUILD_URL" "$WORKSPACE" + + echo "Build logs: " +fi +