From 327dae148d26f3eb1ed05c515916454279d87a77 Mon Sep 17 00:00:00 2001 From: Houa Yang Date: Tue, 1 Oct 2019 15:06:03 -0500 Subject: [PATCH] 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 --- shell/logs-deploy.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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 + -- 2.16.6