2014-05-30 15:15:51 -07:00
|
|
|
#!/bin/bash -xe
|
|
|
|
|
2015-01-27 15:26:31 +11:00
|
|
|
RETRY_LIMIT=20
|
|
|
|
|
2015-01-30 10:49:13 +11:00
|
|
|
# Keep fetching until this uuid appears in the logs before uploading
|
2015-01-27 11:15:59 +11:00
|
|
|
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
|
2015-01-30 17:22:39 -08:00
|
|
|
rm -f /tmp/console.html
|
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
|
2015-01-30 16:12:41 -08:00
|
|
|
curl -X POST --data "start=$(stat -c %s /tmp/console.html || echo 0)" --insecure $BUILD_URL$console_log_path >> /tmp/console.html
|
2015-01-27 11:15:59 +11:00
|
|
|
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
|