From 3b99cd4d3bec4dcd56297f28317af62f26c078bf Mon Sep 17 00:00:00 2001 From: Houa Yang Date: Wed, 25 Mar 2020 11:05:47 -0500 Subject: [PATCH] Fix update to logs-deploy.sh Fix script to remove outputting $ARCHIVE_ARTIFACTS. Outputting required that $ARCHIVE_ARTIFACTS be set for every job. Instead it will output ${pattern_opts:-}. Signed-off-by: Houa Yang Change-Id: I5f75a12745d1358b89dc7af18a35736514143072 --- .../fix-logs-deploy-update-3f26df9e5fded2cc.yaml | 7 +++++++ shell/logs-deploy.sh | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/fix-logs-deploy-update-3f26df9e5fded2cc.yaml diff --git a/releasenotes/notes/fix-logs-deploy-update-3f26df9e5fded2cc.yaml b/releasenotes/notes/fix-logs-deploy-update-3f26df9e5fded2cc.yaml new file mode 100644 index 00000000..2d9a659f --- /dev/null +++ b/releasenotes/notes/fix-logs-deploy-update-3f26df9e5fded2cc.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fix script to remove outputting $ARCHIVE_ARTIFACTS. Outputting required + that $ARCHIVE_ARTIFACTS be set for every job. Instead it will output + ${pattern_opts:-}, which if $ARCHIVE_ARTIFACTS is not + set, will be blank. diff --git a/shell/logs-deploy.sh b/shell/logs-deploy.sh index 5c0956d9..f1b5911e 100644 --- a/shell/logs-deploy.sh +++ b/shell/logs-deploy.sh @@ -18,12 +18,12 @@ function get_pattern_opts() { opts=() for arg in ${ARCHIVE_ARTIFACTS:-}; do - opts+=("-p" "$arg)") + opts+=("-p" "$arg") done echo "${opts[@]-}" } -pattern_opts="$(get_pattern_opts)" +pattern_opts=$(get_pattern_opts) if [[ -z ${LOGS_SERVER:-} ]]; then echo "WARNING: Nexus logging server not set" @@ -32,13 +32,14 @@ else nexus_path="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}" echo "INFO: Nexus URL $nexus_url path $nexus_path" - echo "INFO: archiving workspace using pattern(s): $ARCHIVE_ARTIFACTS" - lftools deploy archives ${pattern_opts:+"$pattern_opts"} "$nexus_url" "$nexus_path" "$WORKSPACE" + echo "INFO: archiving workspace using pattern(s): ${pattern_opts:-}" + # shellcheck disable=SC2086 + lftools deploy archives ${pattern_opts:-} "$nexus_url" "$nexus_path" "$WORKSPACE" - echo "INFO: archiving logs" + echo "INFO: archiving logs to Nexus" lftools deploy logs "$nexus_url" "$nexus_path" "${BUILD_URL:-}" - echo "Build logs: $LOGS_SERVER/$nexus_path" + echo "Nexus build logs: $LOGS_SERVER/$nexus_path" fi if [[ -z ${S3_BUCKET:-} ]]; then @@ -47,9 +48,11 @@ else s3_path="$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER/" echo "INFO: S3 path $s3_path" - lftools deploy s3 ${pattern_opts:+"$pattern_opts"} "$S3_BUCKET" "$s3_path" \ + echo "INFO: archiving logs to S3" + # shellcheck disable=SC2086 + lftools deploy s3 ${pattern_opts:-} "$S3_BUCKET" "$s3_path" \ "$BUILD_URL" "$WORKSPACE" - echo "Build logs: " + echo "S3 build logs: " fi -- 2.16.6