2014-05-30 15:15:51 -07:00
|
|
|
#!/bin/bash -xe
|
|
|
|
|
2015-01-27 15:26:31 +11:00
|
|
|
RETRY_LIMIT=20
|
|
|
|
|
2015-01-27 11:15:59 +11:00
|
|
|
# Keep fetching until this uuid to appear in the logs before uploading
|
|
|
|
END_UUID=$(cat /proc/sys/kernel/random/uuid)
|
|
|
|
|
|
|
|
echo "Grabbing consoleLog ($END_UUID)"
|
2014-05-30 15:15:51 -07:00
|
|
|
|
2015-01-27 11:59:54 +11:00
|
|
|
# Since we are appending to fetched logs, remove any possibly old runs
|
|
|
|
rm -f /tmp/console.txt /tmp/console.html
|
|
|
|
|
2014-10-07 16:58:57 +11:00
|
|
|
# Get the plain text version (does not contain links or timestamps)
|
2015-01-27 15:26:31 +11:00
|
|
|
TRIES=0
|
2014-10-08 06:15:43 +11:00
|
|
|
console_log_path='consoleText'
|
2015-01-27 11:15:59 +11:00
|
|
|
while ! grep -q "$END_UUID" /tmp/console.txt; do
|
2015-01-27 15:26:31 +11:00
|
|
|
TRIES=$((TRIES+1))
|
|
|
|
if [ $TRIES -gt $RETRY_LIMIT ]; then
|
|
|
|
break
|
2015-01-27 16:47:17 +11:00
|
|
|
fi
|
2015-01-27 11:15:59 +11:00
|
|
|
sleep 3
|
|
|
|
wget -c -O /tmp/console.txt --no-check-certificate $BUILD_URL$console_log_path
|
|
|
|
done
|
2014-10-07 16:58:57 +11:00
|
|
|
|
|
|
|
# Grab the HTML version of the log (includes timestamps)
|
2015-01-27 15:26:31 +11:00
|
|
|
TRIES=0
|
2014-10-07 16:58:57 +11:00
|
|
|
console_log_path='logText/progressiveHtml'
|
2015-01-27 11:15:59 +11:00
|
|
|
while ! grep -q "$END_UUID" /tmp/console.html; do
|
2015-01-27 15:26:31 +11:00
|
|
|
TRIES=$((TRIES+1))
|
|
|
|
if [ $TRIES -gt $RETRY_LIMIT ]; then
|
|
|
|
break
|
2015-01-27 16:47:17 +11:00
|
|
|
fi
|
2015-01-27 11:15:59 +11:00
|
|
|
sleep 3
|
|
|
|
wget -c -O /tmp/console.html --no-check-certificate $BUILD_URL$console_log_path
|
|
|
|
done
|
2014-10-07 16:58:57 +11:00
|
|
|
|
|
|
|
# We need to add <pre> tags around the output for log-osanalyze to not escape
|
|
|
|
# the content
|
|
|
|
|
|
|
|
sed -i '1s/^/<pre>\n/' /tmp/console.html
|
|
|
|
echo "</pre>" >> /tmp/console.html
|