summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2021-04-16 18:33:15 -0400
committerDave Wallace <dwallacelf@gmail.com>2021-05-08 23:48:45 +0000
commitab41eb500db92f8c8ae95a0ec7bd6909542696d9 (patch)
treecebf162e0ea261da51e6b1d4f8b2c2ce3ed11248
parentcfdfb5e6558ea153df9126881935a8a4fb6c5f7e (diff)
Backup console logs to consul.
- Add additional executor info to console output for consul log storage. Change-Id: Ifc9174ff69f26aa31f92e3680606f7a2303b5924 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rwxr-xr-xjjb/scripts/backup_upload_archives.sh27
-rwxr-xr-xjjb/scripts/post_build_executor_info.sh10
2 files changed, 27 insertions, 10 deletions
diff --git a/jjb/scripts/backup_upload_archives.sh b/jjb/scripts/backup_upload_archives.sh
index 8d6a8f4..b496749 100755
--- a/jjb/scripts/backup_upload_archives.sh
+++ b/jjb/scripts/backup_upload_archives.sh
@@ -19,8 +19,8 @@ PYTHON_SCRIPT="/w/workspace/test-logs/artifact.py"
# This script uploads the artifacts to a backup upload location
if [ -f "$PYTHON_SCRIPT" ]; then
- echo "WARNING: $PYTHON_SCRIPT already exists - assume backup archive upload already done"
- exit 0
+ echo "WARNING: $PYTHON_SCRIPT already exists - assume backup archive upload already done"
+ exit 0
fi
# the Python code below needs boto3 installed
@@ -35,6 +35,7 @@ cat >$PYTHON_SCRIPT <<'END_OF_PYTHON_SCRIPT'
import argparse
import gzip
import os
+import requests
from mimetypes import MimeTypes
from boto3 import resource
@@ -159,13 +160,11 @@ if __name__ == u"__main__":
END_OF_PYTHON_SCRIPT
WS_ARCHIVES_DIR="$WORKSPACE/archives"
-JENKINS_BUILD_ARCHIVE_DIR="$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER"
-
TMP_ARCHIVES_DIR="/tmp/archives"
-mkdir -p $TMP_ARCHIVES_DIR
-pushd $TMP_ARCHIVES_DIR
+JENKINS_BUILD_ARCHIVE_DIR="$TMP_ARCHIVES_DIR/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER"
mkdir -p $JENKINS_BUILD_ARCHIVE_DIR
+
if [ -e "$WS_ARCHIVES_DIR" ]; then
echo "Found $WS_ARCHIVES_DIR, uploading its contents"
cp -r $WS_ARCHIVES_DIR/* $JENKINS_BUILD_ARCHIVE_DIR
@@ -174,8 +173,18 @@ else
echo "No archives found while doing backup upload" > "$JENKINS_BUILD_ARCHIVE_DIR/no-archives-found.txt"
fi
-echo "Contents of the archives dir:"
+console_log="$JENKINS_BUILD_ARCHIVE_DIR/console.log"
+echo "Downloading Jenkins console log to '$console_log'"
+wget -qO "$console_log" "$BUILD_URL/consoleText"
+
+console_log="$JENKINS_BUILD_ARCHIVE_DIR/console-timestamp.log"
+echo "Downloading Jenkins console timestamp log to '$console_log'"
+wget -qO "$console_log" "$BUILD_URL/timestamps?time=HH:mm:ss&appendLog"
+
+pushd $TMP_ARCHIVES_DIR
+echo "Contents of the archives dir '$TMP_ARCHIVES_DIR':"
ls -alR $TMP_ARCHIVES_DIR
-echo "Running uploader script $PYTHON_SCRIPT:"
-python3 $PYTHON_SCRIPT -d . -b logs || echo "Failed to upload logs"
+archive_cmd="python3 $PYTHON_SCRIPT -d . -b logs"
+echo -e "\nRunning uploader script '$archive_cmd':\n"
+$archive_cmd || echo "Failed to upload logs"
popd
diff --git a/jjb/scripts/post_build_executor_info.sh b/jjb/scripts/post_build_executor_info.sh
index f361900..f986666 100755
--- a/jjb/scripts/post_build_executor_info.sh
+++ b/jjb/scripts/post_build_executor_info.sh
@@ -24,15 +24,23 @@ OS_ARCH=$(uname -m)
echo "$long_line"
echo "Executor Runtime Attributes:"
echo "OS: $OS_ID-$OS_VERSION_ID"
+echo " $(uname -a)"
+echo "Number CPUs: $(nproc)"
echo "Arch: $OS_ARCH"
echo "Nomad Hostname: $(grep search /etc/resolv.conf | cut -d' ' -f2 | head -1)"
echo "Container ID: $(hostname)"
+echo "$long_line"
+echo -e "lscpu:\n$(lscpu)"
+echo "$long_line"
+echo -e "df -h:\n$(df -h)"
+echo "$long_line"
+echo -e "free -m:\n$(free -m)"
if [ -n "$(which ccache)" ] ; then
echo "$long_line"
+ echo "ccache statistics:"
[ -n "${CCACHE_DISABLE:-}" ] && echo "CCACHE_DISABLE = '$CCACHE_DISABLE'"
[ -n "${CCACHE_DIR:-}" ] && echo "CCACHE_DIR = '$CCACHE_DIR'"
- echo "ccache statistics:"
ccache -s
fi