1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:04:41 -07:00

dashboard: include last 100 lines in build failure mail

R=golang-dev, rsc, iant, robert.hencke
CC=golang-dev
https://golang.org/cl/5235041
This commit is contained in:
Andrew Gerrand 2011-10-09 06:50:21 +11:00
parent b536adbfba
commit d3eefb8cf3
2 changed files with 11 additions and 4 deletions

View File

@ -4,3 +4,6 @@ http://godashboard.appspot.com/log/{{loghash}}
{{desc}} {{desc}}
http://code.google.com/p/go/source/detail?r={{node}} http://code.google.com/p/go/source/detail?r={{node}}
$ tail -n 100 < log
{{log}}

View File

@ -343,7 +343,7 @@ class Build(webapp.RequestHandler):
c = getBrokenCommit(node, builder) c = getBrokenCommit(node, builder)
if c is not None and not c.fail_notification_sent: if c is not None and not c.fail_notification_sent:
notifyBroken(c, builder) notifyBroken(c, builder, log)
self.response.set_status(200) self.response.set_status(200)
@ -388,7 +388,7 @@ def nodeBefore(c):
def nodeAfter(c): def nodeAfter(c):
return Commit.all().filter('parenthash', c.node).get() return Commit.all().filter('parenthash', c.node).get()
def notifyBroken(c, builder): def notifyBroken(c, builder, log):
def send(): def send():
n = Commit.get(c.key()) n = Commit.get(c.key())
if n is None: if n is None:
@ -399,7 +399,10 @@ def notifyBroken(c, builder):
n.fail_notification_sent = True n.fail_notification_sent = True
return n.put() return n.put()
if not db.run_in_transaction(send): 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]) subject = const.mail_fail_subject % (builder, c.desc.split('\n')[0])
path = os.path.join(os.path.dirname(__file__), 'fail-notify.txt') path = os.path.join(os.path.dirname(__file__), 'fail-notify.txt')
@ -408,7 +411,8 @@ def notifyBroken(c, builder):
"node": c.node, "node": c.node,
"user": c.user, "user": c.user,
"desc": c.desc, "desc": c.desc,
"loghash": logHash(c, builder) "loghash": logHash(c, builder),
"log": log,
}) })
mail.send_mail( mail.send_mail(
sender=const.mail_from, sender=const.mail_from,