-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfetch_logs.sh
executable file
·50 lines (39 loc) · 1.12 KB
/
fetch_logs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
set -eu
# Description:
# Fetches logs from Executer machine
# Usage:
# fetch_logs.sh
#
CI_DIR="$(dirname "$(readlink -f "${0}")")"
IMAGE_OS="${IMAGE_OS:-ubuntu}"
BUILD_TAG="${BUILD_TAG:-logs_integration_tests}"
# shellcheck disable=SC1091
source "${CI_DIR}/utils.sh"
TEST_EXECUTER_IP="192.168.1.3"
declare -a SSH_OPTIONS=(
-o StrictHostKeyChecking=no
-o UserKnownHostsFile=/dev/null
-o ServerAliveInterval=15
-o ServerAliveCountMax=10
-i "${METAL3_CI_USER_KEY}"
)
# Send Remote script to Executer
scp \
"${SSH_OPTIONS[@]}" \
"${CI_DIR}/files/run_fetch_logs.sh" \
"${METAL3_CI_USER}@${TEST_EXECUTER_IP}:/tmp/" > /dev/null
echo "Fetching logs"
# Execute remote script
# shellcheck disable=SC2029
ssh \
"${SSH_OPTIONS[@]}" \
"${METAL3_CI_USER}"@"${TEST_EXECUTER_IP}" \
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/bin \
/tmp/run_fetch_logs.sh "logs-${BUILD_TAG}.tgz" \
"logs-${BUILD_TAG}" "${IMAGE_OS}"
# fetch logs tarball
scp \
"${SSH_OPTIONS[@]}" \
"${METAL3_CI_USER}@${TEST_EXECUTER_IP}:logs-${BUILD_TAG}.tgz" \
"./" > /dev/null