1
0
mirror of https://github.com/golang/go synced 2024-11-25 02:57:57 -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}}
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)
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:
@ -401,6 +401,9 @@ def notifyBroken(c, builder):
if not db.run_in_transaction(send):
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')
body = template.render(path, {
@ -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,