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 # Allows folks to copy sandbox logs over to releng for longer storage
13 # In some cases folks would like to save sandbox logs for a longer period of
14 # time in order to troubleshoot difficult tasks. This script can be used to
15 # trigger Jenkins production to copy specific logs over for longer storage.
17 # This is triggered via Gerrit comment.
18 # Usage: copy-logs: JOB_NAME/BUILD_NUMBER
19 echo "---> copy-sandbox-logs.sh"
21 build_path="$(echo "$GERRIT_EVENT_COMMENT_TEXT" | base64 -d | grep 'copy-logs:' | awk -F: '{print $2}' | tr -d '[:space:]')"
22 fetch_url="https://s3-logs.opendaylight.org/logs/sandbox/vex-yul-odl-jenkins-2/$build_path"
24 COPY_DIR="$WORKSPACE/archives"
26 pushd "$COPY_DIR" || exit
28 # Ensure that the repo_url has a trailing slash as wget needs it to work
33 fetch_url="$fetch_url/"
37 echo "Fetching artifacts from $fetch_url..."
38 wget -nv --recursive --execute robots=off --no-parent \
39 --no-host-directories --cut-dirs=2 --level=15 \
42 echo "Removing files that do not need to be cloned..."
43 mapfile -t remove_files < <(find . -type f -name "*index.html*")
44 for f in "${remove_files[@]}"; do