Updating tempestmail template mail

This patch updates the template used by tempestmail with more informations:

* Information about stackviz
* Fix stackviz link for upstream jobs
* Information in case the log url can't be found and how to fix it
* New filter for parse data in format dd-mm-yyyy hh:mm
* Adding the number of failures and known failures on the particular job

Change-Id: I69936795e2fbd631b556db0058d6827d35c6548d
This commit is contained in:
Arx Cruz 2017-07-27 11:43:23 +02:00
parent 39d7227c11
commit 3992ef3569
2 changed files with 25 additions and 10 deletions

View File

@ -99,9 +99,13 @@ class Mail(object):
def render_template(self, data): def render_template(self, data):
self.log.debug('Rendering template') self.log.debug('Rendering template')
env = Environment(loader=FileSystemLoader(self.templates_path)) env = Environment(loader=FileSystemLoader(self.templates_path))
env.filters['datetimeformat'] = self.datetimeformat
template = env.get_template(self.template) template = env.get_template(self.template)
return template.render(data=data) return template.render(data=data)
def datetimeformat(self, value, format="%d-%m-%Y %H:%M"):
return value.strftime(format)
def filter_emails(self, job, data): def filter_emails(self, job, data):
has_errors = False has_errors = False
addresses = [] addresses = []

View File

@ -2,23 +2,32 @@
<head></head> <head></head>
<body> <body>
<p>Hello,</p> <p>Hello,</p>
<p>Here's the result of the latest tempest run for job {{ data.get('job') }}.</p> <p>This is an automated email with tempest results for job <b>{{ data.get('job') }}</b>.</p>
<p>The job ran on {{ data.get('date') }}.</p> <p>The job ran on {{ data.get('date')|datetimeformat }}.</p>
<p>For more details, you can check the URL: {{ data.get('link') }} (It might take a few minutes to upload the logs).</p>
{% if 'Not available yet' not in data.get('link') %} {% if 'Not available yet' not in data.get('link') %}
<p>You can see the stackviz results <a href="{{ data.get('link') }}logs/oooq/stackviz/">here</a> <p>The logs are being uploaded, and it will be available soon. Usually, it take between 5 and 10 minutes to became available, depending of the amount of data it's being uploaded, so don't worry if you don't see the logs right now.</p>
<p>Once the logs are available, you can check clicking <a href="{{ data.get('link') }}">here</a></p>
<p>Mostly jobs upstream provides a tool to easily visualize and analyze the performance and execution of each tempest job.</p>
<p>This tool is called stackviz, and you can see the results <a href="{{ data.get('link') }}logs/stackviz/">here</a> if available</p>
{% else %}
<p>Unfortunate the script that send this email wasn't able to find the url where the logs are. Perhaps wasn't passed</p>
<p>to the script, or something wrong happened. If you think it's a mistake, please contact us on irc.freenode.org</p>
<p>on channel #tripleo if it's related to a upstream job, or if you're using this service in your own infrastructure,</p>
<p>be sure you are setting the environment variable LOG_PATH in your job.</p>
{% endif %} {% endif %}
<p>Below you can see a resume of the tempest execution for this particular job:</p>
{% if 'new' in data and data.new %} {% if 'new' in data and data.new %}
<h2>New failures</h2> <h2><font color="red">New failures ({{ data.new|length}}):</font></h2>
<p>These are new failures for this particular run, some action is needed in order to fix it</p>
<ul> <ul>
{% for fail in data.new %} {% for fail in data.new %}
<li>{{ fail }}</li> <li>{{ fail }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
{% if 'covered' in data and data.covered %} {% if 'covered' in data and data.covered %}
<h2>Known failures</h2> <h2>Known failures ({{ data.covered|length }}):</h2>
<p>These are known failures, and should have a launchpad or a bugzilla opened for it.</p>
<ul> <ul>
{% for fail in data.covered %} {% for fail in data.covered %}
<li>{{ fail.failure }} - {{ fail.reason }}</li> <li>{{ fail.failure }} - {{ fail.reason }}</li>
@ -26,18 +35,20 @@
</ul> </ul>
{% endif %} {% endif %}
{% if ('has_errors' in data and 'run' in data) and not data.has_errors and data.run %} {% if ('has_errors' in data and 'run' in data) and not data.has_errors and data.run %}
<h2>Job ran successfully!</h2> <h2><font color="green">Job ran successfully!</font></h2>
<p>We consider a successfull run even if it has Known failures, since these are covered.</p> <p>We consider a successfull run even if it has Known failures, since these are covered.</p>
{% endif %} {% endif %}
{% if not data.run %} {% if not data.run %}
<h2>There's no tempest results!</h2> <h2><font color="red">There's no tempest results!</font></h2>
<p>This means that the TripleO installation might have finished sucessfully, however, tempest either fail before tests started, or didn't ran at all.</p> <p>This means that the TripleO installation might have finished sucessfully, however, tempest either fail before tests started, or didn't ran at all.</p>
<p>One of the places to begin check is <a href="{{ data.get('link') }}logs/undercloud/home/jenkins/">here</a> (the link might don't exist depending of the type of error)
{% endif %} {% endif %}
<p></p> <p></p>
<p>You are receiving this email because someone from TripleO team though you were interested in these results.</p> <p>You are receiving this email because someone from TripleO team though you would be interested in these results.</p>
<p></p> <p></p>
<p>If you're interested in receive these emails, please submit a code review <a href="https://github.com/openstack/tripleo-quickstart-extras/blob/master/roles/validate-tempest/files/tempestmail/config.yaml">here</a> <p>If you're interested in receive these emails, please submit a code review <a href="https://github.com/openstack/tripleo-quickstart-extras/blob/master/roles/validate-tempest/files/tempestmail/config.yaml">here</a>
including your email address</p> including your email address</p>
<p>We also have a <a href="http://cistatus.tripleo.org/">website with status of our current jobs</a> if you are interested.</p>
</body> </body>
</html> </html>