2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> logs-deploy.sh"
13 # shellcheck disable=SC1090
15 lf-activate-venv lftools
17 # Ensure we fail the job if any steps fail
21 # The 'lftool deploy archives' command below expects the archives
22 # directory to exist. Normally lf-infra-sysstat or similar would
23 # create it and add content, but to make sure this script is
24 # self-contained, we ensure it exists here.
25 mkdir -p "$WORKSPACE/archives"
27 function get_pattern_opts()
30 for arg in ${ARCHIVE_ARTIFACTS:-}; do
36 pattern_opts=$(get_pattern_opts)
38 if [[ -z ${LOGS_SERVER:-} ]]; then
39 echo "WARNING: Nexus logging server not set"
41 nexus_url="${NEXUSPROXY:-$NEXUS_URL}"
42 nexus_path="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
43 echo "INFO: Nexus URL $nexus_url path $nexus_path"
45 echo "INFO: archiving workspace using pattern(s): ${pattern_opts:-}"
46 # shellcheck disable=SC2086
47 lftools deploy archives ${pattern_opts:-} "$nexus_url" "$nexus_path" "$WORKSPACE"
49 echo "INFO: archiving logs to Nexus"
50 lftools deploy logs "$nexus_url" "$nexus_path" "${BUILD_URL:-}"
52 echo "Nexus build logs: <a href=\"$LOGS_SERVER/$nexus_path\">$LOGS_SERVER/$nexus_path</a>"
55 if [[ -z ${S3_BUCKET:-} ]]; then
56 echo "WARNING: S3 logging server not set"
58 s3_path="logs/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER/"
59 echo "INFO: S3 path $s3_path"
61 echo "INFO: archiving logs to S3"
62 # shellcheck disable=SC2086
63 lftools deploy s3 ${pattern_opts:-} "$S3_BUCKET" "$s3_path" \
64 "$BUILD_URL" "$WORKSPACE"
66 echo "S3 build logs: <a href=\"https://$CDN_URL/$s3_path\"></a>"