--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2017 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+# Allows folks to copy sandbox logs over to releng for longer storage
+#
+# In some cases folks would like to save sandbox logs for a longer period of
+# time in order to troubleshoot difficult tasks. This script can be used to
+# trigger Jenkins production to copy specific logs over for longer storage.
+#
+# This is triggered via Gerrit comment.
+# Usage: copy-logs: JOB_NAME/BUILD_NUMBER
+echo "---> copy-sandbox-logs.sh"
+
+build_path="$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep 'copy-logs:' | awk -F: '{print $2}' | tr -d '[:space:]')"
+fetch_url="https://logs.opendaylight.org/sandbox/vex-yul-odl-jenkins-2/$build_path"
+
+COPY_DIR="$WORKSPACE/archives"
+mkdir -p "$COPY_DIR"
+pushd "$COPY_DIR" || exit
+
+# Ensure that the repo_url has a trailing slash as wget needs it to work
+case "$fetch_url" in
+ */)
+ ;;
+ *)
+ fetch_url="$fetch_url/"
+ ;;
+esac
+
+echo "Fetching artifacts from $fetch_url..."
+wget -nv --recursive --execute robots=off --no-parent \
+ --no-host-directories --cut-dirs=2 --level=15 \
+ "$fetch_url"
+
+echo "Removing files that do not need to be cloned..."
+mapfile -t remove_files < <(find . -type f -name "*index.html*")
+for f in "${remove_files[@]}"; do
+ rm "$f"
+done
+popd || exit
jobs:
- '{project-name}-ci-jobs'
- builder-check-poms
+ - builder-copy-sandbox-logs
- gerrit-tox-verify
# OpenStack Related
- 'builder-verify-image-protection'
email-prefix: '[releng]'
- lf-infra-publish
+- job-template:
+ name: builder-copy-sandbox-logs
+ node: centos7-builder-2c-8g
+
+ project-type: freestyle
+
+ properties:
+ - opendaylight-infra-properties:
+ build-days-to-keep: 1
+
+ parameters:
+ - opendaylight-infra-parameters:
+ os-cloud: ''
+ project: ''
+ branch: ''
+ refspec: ''
+ artifacts: ''
+
+ wrappers:
+ - opendaylight-infra-wrappers:
+ build-timeout: 10
+
+ triggers:
+ - gerrit:
+ server-name: '{gerrit-server-name}'
+ trigger-on:
+ - comment-added-contains-event:
+ comment-contains-value: 'copy-logs:'
+ projects:
+ - project-compare-type: ANT
+ project-pattern: '**'
+ branches:
+ - branch-compare-type: ANT
+ branch-pattern: '**'
+
+ builders:
+ - shell: !include-raw-escape: copy-sandbox-logs.sh
+
+ publishers:
+ - lf-infra-publish
+
- job-template:
name: 'builder-verify-image-protection'