]> Cypherpunks repositories - gostls13.git/commitdiff
dashboard: include last 100 lines in build failure mail
authorAndrew Gerrand <adg@golang.org>
Sat, 8 Oct 2011 19:50:21 +0000 (06:50 +1100)
committerAndrew Gerrand <adg@golang.org>
Sat, 8 Oct 2011 19:50:21 +0000 (06:50 +1100)
R=golang-dev, rsc, iant, robert.hencke
CC=golang-dev
https://golang.org/cl/5235041

misc/dashboard/godashboard/fail-notify.txt
misc/dashboard/godashboard/gobuild.py

index a699005eab30cf48e3ad187f5648ba5af21edb19..f75d09aa2121e56f85505c963b342de65a952c27 100644 (file)
@@ -4,3 +4,6 @@ http://godashboard.appspot.com/log/{{loghash}}
 {{desc}}
 
 http://code.google.com/p/go/source/detail?r={{node}}
+
+$ tail -n 100 < log
+{{log}}
index ae8d99b3f85b8c578f79bb3a8e426cec51016cd5..1f9db79380f71f652a1818a6107ac625849235ce 100644 (file)
@@ -343,7 +343,7 @@ class Build(webapp.RequestHandler):
 
         c = getBrokenCommit(node, builder)
         if c is not None and not c.fail_notification_sent:
-            notifyBroken(c, builder)
+            notifyBroken(c, builder, log)
 
         self.response.set_status(200)
 
@@ -388,7 +388,7 @@ def nodeBefore(c):
 def nodeAfter(c):
     return Commit.all().filter('parenthash', c.node).get()
 
-def notifyBroken(c, builder):
+def notifyBroken(c, builder, log):
     def send():
         n = Commit.get(c.key())
         if n is None:
@@ -399,7 +399,10 @@ def notifyBroken(c, builder):
         n.fail_notification_sent = True
         return n.put()
     if not db.run_in_transaction(send):
-       return
+        return
+
+    # get last 100 lines of the build log
+    log = '\n'.join(log.split('\n')[-100:])
 
     subject = const.mail_fail_subject % (builder, c.desc.split('\n')[0])
     path = os.path.join(os.path.dirname(__file__), 'fail-notify.txt')
@@ -408,7 +411,8 @@ def notifyBroken(c, builder):
         "node": c.node,
         "user": c.user,
         "desc": c.desc,
-        "loghash": logHash(c, builder)
+        "loghash": logHash(c, builder),
+        "log": log,
     })
     mail.send_mail(
         sender=const.mail_from,