Bug 1586290 - [iris firefox] Add email notifications for failing builds r=KWierso,tomprince

Differential Revision: https://phabricator.services.mozilla.com/D48738

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Brandt 2019-10-16 21:32:44 +00:00
parent f6dee32218
commit 73375c18cb
2 changed files with 70 additions and 0 deletions

View File

@ -31,6 +31,26 @@ job-defaults:
osx.*: build-macosx64-shippable/opt osx.*: build-macosx64-shippable/opt
windows10-64.*: build-win64-shippable/opt windows10-64.*: build-win64-shippable/opt
description: Run the iris test suite's {} tests description: Run the iris test suite's {} tests
notify:
email:
by-project:
try:
subject: 'Iris Firefox {chunk} has completed a test run for a patch on (try)'
message: A team member has submitted a patch to try and the results are in.
link:
text: Treeherder Job
href: '{th_root}jobs?repo={project}&revision={head_rev}{tiers}{filterstring}'
on-reasons: [any]
emails: [iris@mozilla.com]
mozilla-central:
subject: 'Iris Firefox {chunk} tests failed (mozilla-central)'
message: This calls for an action from the QA Automation team. Use the link to view it on Treeherder.
link:
text: Treeherder Job
href: '{th_root}jobs?repo={project}&revision={head_rev}{tiers}{filterstring}'
on-reasons: [failed]
emails: [iris@mozilla.com]
default: []
fetches: fetches:
build: build:
by-platform: by-platform:

View File

@ -61,3 +61,53 @@ def make_iris_tasks(config, jobs):
del clone["worker"]["env"]["PATH"] del clone["worker"]["env"]["PATH"]
yield clone yield clone
@transforms.add
def fill_email_data(config, tasks):
format_kwargs = {
"head_rev": config.params["head_rev"],
"project": config.params["project"],
"th_root": "https://treeherder.mozilla.org/#/",
"tiers": "&tier=1%2C2%2C3",
}
for task in tasks:
format_kwargs["task_name"] = task["name"]
format_kwargs["filterstring"] = "&searchStr=iris%20{}".format(task["name"])
format_kwargs["chunk"] = task["worker"]["env"]["CURRENT_TEST_DIR"]
resolve_keyed_by(task, 'notify.email', item_name=task["name"], **{
'project': config.params["project"],
})
email = task["notify"].get("email")
if email:
email["link"]["href"] = email["link"]["href"].format(**format_kwargs)
email["subject"] = email["subject"].format(**format_kwargs)
yield task
@transforms.add
def add_notify_email(config, tasks):
for task in tasks:
notify = task.pop('notify', {})
email_config = notify.get('email')
if email_config:
extra = task.setdefault('extra', {})
notify = extra.setdefault('notify', {})
notify['email'] = {
'subject': email_config['subject'],
'content': email_config['message'],
'link': email_config.get('link', None),
}
routes = task.setdefault('routes', [])
routes.extend([
'notify.email.{}.on-{}'.format(address, reason)
for address in email_config['emails']
for reason in email_config['on-reasons']
])
yield task