Install private jenkins for CD jobs
[icn.git] / ci / jjb / shell / org-logs-deploy.sh
1 #!/bin/bash -l
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
5 #
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"
12
13 # Ensure we fail the job if any steps fail
14 # Disable 'globbing'
15 set -euf -o pipefail
16
17 JENKINS_HOSTNAME=pod14-node2
18 NEXUS_URL=https://nexus.akraino.org
19 LOGS_SERVER=https://logs.akraino.org
20
21 NEXUS_LOG_SUBDIR=${NEXUS_LOG_SUBDIR:-$SILO}
22
23 source ~/.local/bin/activate
24 if [[ -z $"${LOGS_SERVER:-}" ]]; then
25     echo "WARNING: Logging server not set"
26 else
27     nexus_url="${NEXUSPROXY:-$NEXUS_URL}"
28     nexus_path="${NEXUS_LOG_SUBDIR}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
29
30     if [[ -n ${ARCHIVE_ARTIFACTS:-} ]] ; then
31         # Handle multiple search extensions as separate values to '-p|--pattern'
32         # "arg1 arg2" -> (-p arg1 -p arg2)
33         pattern_opts=()
34         for arg in $ARCHIVE_ARTIFACTS; do
35             pattern_opts+=("-p" "$arg")
36         done
37         lftools deploy archives "${pattern_opts[@]}" \
38                 "$nexus_url" "$nexus_path" "$WORKSPACE"
39     else
40         lftools deploy archives "$nexus_url" "$nexus_path" "$WORKSPACE"
41     fi
42     lftools deploy logs "$nexus_url" "$nexus_path" "${BUILD_URL:-}"
43
44     echo "Build logs: <a href=\"$LOGS_SERVER/$nexus_path\">$LOGS_SERVER/$nexus_path</a>"
45 fi