From 0f44961ec9d6f5e0d44d7518d73919932c9ef331 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Tue, 27 Jan 2015 15:26:31 +1100 Subject: [PATCH] Put in a retry limit for fetching logs Change-Id: Iaf82e449fa8d006d6d7c85a6774bb92fe68d1736 --- jenkins/scripts/grab_console_log.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jenkins/scripts/grab_console_log.sh b/jenkins/scripts/grab_console_log.sh index 5731894eeb..e2a83b70fb 100755 --- a/jenkins/scripts/grab_console_log.sh +++ b/jenkins/scripts/grab_console_log.sh @@ -1,5 +1,7 @@ #!/bin/bash -xe +RETRY_LIMIT=20 + # Keep fetching until this uuid to appear in the logs before uploading END_UUID=$(cat /proc/sys/kernel/random/uuid) @@ -9,15 +11,25 @@ echo "Grabbing consoleLog ($END_UUID)" rm -f /tmp/console.txt /tmp/console.html # Get the plain text version (does not contain links or timestamps) +TRIES=0 console_log_path='consoleText' while ! grep -q "$END_UUID" /tmp/console.txt; do + TRIES=$((TRIES+1)) + if [ $TRIES -gt $RETRY_LIMIT ]; then + break + done sleep 3 wget -c -O /tmp/console.txt --no-check-certificate $BUILD_URL$console_log_path done # Grab the HTML version of the log (includes timestamps) +TRIES=0 console_log_path='logText/progressiveHtml' while ! grep -q "$END_UUID" /tmp/console.html; do + TRIES=$((TRIES+1)) + if [ $TRIES -gt $RETRY_LIMIT ]; then + break + done sleep 3 wget -c -O /tmp/console.html --no-check-certificate $BUILD_URL$console_log_path done