summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2014-08-07 14:55:15 (GMT)
committerMichael Drake <michael.drake@codethink.co.uk>2014-08-07 14:55:15 (GMT)
commite90d95117b545358cd889b5cd2acd1b673aa7e03 (patch)
treeb5026f6bfefa61c3e805a3f3a946c945f76c7f88
parente752380753b9657c60bae790c10f2a0867e56009 (diff)
downloaddefinitions-baserock/michaeldrake/mason-net-down-report.tar.gz
Detect lack of network and report as such, rather than failbaserock/michaeldrake/mason-net-down-report
If the git remote update command fails, we assume it's because we are unable to connect to the trove. This gets reported as a networking issue, rather than as a failure.
-rwxr-xr-xmason/mason-report.sh21
-rwxr-xr-xmason/mason.sh5
2 files changed, 24 insertions, 2 deletions
diff --git a/mason/mason-report.sh b/mason/mason-report.sh
index d6cf0c1..40ecbf6 100755
--- a/mason/mason-report.sh
+++ b/mason/mason-report.sh
@@ -57,6 +57,12 @@ table tr.fail {
table tr.fail:hover {
background: #ffbbbb;
}
+table tr.nonet {
+ background: #ffdd99;
+}
+table tr.nonet:hover {
+ background: #ffeeaa;
+}
table tr.headings th {
font-weight: bold;
text-align: left;
@@ -87,6 +93,12 @@ tr.fail td.result a {
tr.fail td.result a:hover {
color: #933;
}
+tr.nonet td.result a {
+ color: #641;
+}
+tr.nonet td.result a:hover {
+ color: #962;
+}
td.ref {
font-family: monospace;
}
@@ -161,7 +173,11 @@ update_report() {
fi
# Build table row for insertion into report file
- msg='<tr class="'"${build_result}"'"><td>'"${build_start_time}"'</td><td class="ref"><a href="http://'"${build_trove_host}"'/cgi-bin/cgit.cgi/baserock/baserock/definitions.git/commit/?h='"${build_ref}"'&id='"${build_sha1}"'">'"${build_sha1}"'</a></td><td>'"${build_duration}s"'</td><td class="result"><a href="log/'"${build_sha1}"'--'"${build_start_time}"'.log">'"${build_result}"'</a></td></tr>'
+ if [ "$build_result" = nonet ]; then
+ msg='<tr class="'"${build_result}"'"><td>'"${build_start_time}"'</td><td class="ref">Failed to contact '"${build_trove_host}"'</a></td><td>'"${build_duration}s"'</td><td class="result"><a href="log/'"${build_sha1}"'--'"${build_start_time}"'.log">'"${build_result}"'</a></td></tr>'
+ else
+ msg='<tr class="'"${build_result}"'"><td>'"${build_start_time}"'</td><td class="ref"><a href="http://'"${build_trove_host}"'/cgi-bin/cgit.cgi/baserock/baserock/definitions.git/commit/?h='"${build_ref}"'&id='"${build_sha1}"'">'"${build_sha1}"'</a></td><td>'"${build_duration}s"'</td><td class="result"><a href="log/'"${build_sha1}"'--'"${build_start_time}"'.log">'"${build_result}"'</a></td></tr>'
+ fi
# Insert report line, newest at top
sed -i 's/<!--INSERTION POINT-->/<!--INSERTION POINT-->\n'"$(sed_escape "$msg")"'/' $REPORT_PATH
@@ -178,6 +194,9 @@ case "${PIPESTATUS[0]}" in
33)
RESULT=skip
;;
+42)
+ RESULT=nonet
+ ;;
*)
RESULT=fail
;;
diff --git a/mason/mason.sh b/mason/mason.sh
index dfed71f..1fdcf2d 100755
--- a/mason/mason.sh
+++ b/mason/mason.sh
@@ -22,7 +22,10 @@ else
SHA1_PREV="$(git rev-parse HEAD)"
fi
-git remote update origin
+if ! git remote update origin; then
+ echo ERROR: Unable to contact trove
+ exit 42
+fi
git clean -fxd
git reset --hard origin/"$DEFINITIONS_REF"