Put in a retry limit for fetching logs

Change-Id: Iaf82e449fa8d006d6d7c85a6774bb92fe68d1736
This commit is contained in:
Joshua Hesketh 2015-01-27 15:26:31 +11:00
parent de61f924b1
commit 0f44961ec9

View File

@ -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