Don't dump Jenkins proxy errors to console logs

When grabbing the console logs for jobs in order to upload these logs to
swift we may run into Jenkins proxy errors which then end up in our
console log file.

Avoid this by using curl --fail which will not output any data and
return 22 if the request fails.

While editing this curl command document the odd choice of flags given
as their necessity may not be very apparent.

Change-Id: I7e53e11882046282b95addd635d804fa29b0eb44
This commit is contained in:
Clark Boylan 2015-03-18 10:22:14 -07:00
parent ac0ba89582
commit 8e979b2c95

View File

@ -19,7 +19,16 @@ while ! grep -q "$END_UUID" /tmp/console.html; do
break break
fi fi
sleep 3 sleep 3
curl -X POST --data "start=$(stat -c %s /tmp/console.html || echo 0)" --insecure $BUILD_URL$console_log_path >> /tmp/console.html # -X POST because Jenkins doesn't do partial gets properly when
# job is running.
# --data start=X instructs Jenkins to mimic a partial get using
# POST. We determine how much data we need based on
# how much we already have.
# --fail will cause curl to not output data if the request
# fails. This allows us to retry when we have Jenkins proxy
# errors without polluting the output document.
# --insecure because our Jenkins masters use self signed SSL certs.
curl -X POST --data "start=$(stat -c %s /tmp/console.html || echo 0)" --fail --insecure $BUILD_URL$console_log_path >> /tmp/console.html
done done
# We need to add <pre> tags around the output for log-osanalyze to not escape # We need to add <pre> tags around the output for log-osanalyze to not escape