diff --git a/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2 b/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2 index 5fecdd5ce0..e57cfd075d 100644 --- a/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2 +++ b/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2 @@ -231,6 +231,7 @@ c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg)) from buildbot.status.mail import MailNotifier from buildbot.status.builder import Results +from buildbot.status.results import FAILURE, EXCEPTION, WARNINGS import cgi import re @@ -244,7 +245,7 @@ def html_message_formatter(mode, name, build, results, master_status): """ result = Results[results] - limit_lines = 80 + limit_lines = 40 text = list() text.append(u'

Build status: %s

' % result.upper()) text.append(u'') @@ -256,41 +257,47 @@ def html_message_formatter(mode, name, build, results, master_status): ) text.append(u'' % build.getReason()) text.append(u'
Build Reason:%s
') - text.append(u'
') logs = [] steps = build.getSteps() for step in steps: - if step.getName() == 'runtask': - logs = step.getLogs() - break + status, dummy = step.getResults() + + if status not in [FAILURE, EXCEPTION, WARNINGS]: + continue + + logs = step.getLogs() + + # logs within a step are in reverse order. Search back until we find stdio + for log in reversed(logs): + if log.getName() == 'stdio': + break + + name = "%s.%s" % (step).getName(), log.getName()) + status, dummy = log.getStep().getResults() + content = log.getText().splitlines() # Note: can be VERY LARGE + url = u'%s/steps/%s/logs/%s' % (master_status.getURLForThing(build), + step.getName(), log.getName()) + + text.append(u'

') + text.append(u'Detailed log of the %s build step: %s' + % (name, url, url)) + text.append(u'
') + text.append(u'

Last %d lines of "%s"

' % (limit_lines, name)) + + unilist = list() + for line in content[len(content)-limit_lines:]: + unilist.append(cgi.escape(unicode(line,'utf-8'))) + text.append(u'
')
+            text.extend(unilist)
+            text.append(u'
') - # logs within a step are in reverse order. Search back until we find stdio - for log in reversed(logs): - if log.getName() == 'stdio': - break - name = "%s.%s" % (log.getStep().getName(), log.getName()) - status, dummy = log.getStep().getResults() - content = log.getText().splitlines() # Note: can be VERY LARGE - url = u'%s/steps/%s/logs/%s' % (master_status.getURLForThing(build), - log.getStep().getName(), - log.getName()) - text.append(u'DEBUG: status=%s dummy=%s' % (status, dummy)) - text.append(u'Detailed log of last build step: %s' - % (url, url)) - text.append(u'
') - text.append(u'

Last %d lines of "%s"

' % (limit_lines, name)) - unilist = list() - for line in content[len(content)-limit_lines:]: - unilist.append(cgi.escape(unicode(line,'utf-8'))) - text.append(u'
')
-        text.extend(unilist)
-        text.append(u'
') text.append(u'

') text.append(u'-The Buildbot') taskname = re.search("task=\['(.*)\.yml'\]", t).group(1) test.insert(0, '

Task name: %s

' % taskname) + return { 'body': u"\n".join(text), 'type': 'html'