Bug 1459198 - Set a validation method to make sure notification filters are accurately set. r=dustin

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

--HG--
extra : rebase_source : 7bea1d4a2ea48f1fa5df224be0ab5dffb3e84ad3
This commit is contained in:
Justin Wood 2018-05-04 09:44:57 -04:00
Родитель 605ab3605c
Коммит 7a24d336a5
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -128,6 +128,32 @@ def verify_gecko_v2_routes(task, taskgraph, scratch_pad):
scratch_pad[route] = task.label
@verifications.add('full_task_graph')
def verify_routes_notification_filters(task, taskgraph, scratch_pad):
"""
This function ensures that only understood filters for notifications are
specified.
See: https://docs.taskcluster.net/reference/core/taskcluster-notify/docs/usage
"""
if task is None:
return
route_prefix = "notify."
valid_filters = ('on-any', 'on-completed', 'on-failed', 'on-exception')
task_dict = task.task
routes = task_dict.get('routes', [])
for route in routes:
if route.startswith(route_prefix):
# Get the filter of the route
route_filter = route.split('.')[-1]
if route_filter not in valid_filters:
raise Exception(
'{} has invalid notification filter ({})'
.format(task.label, route_filter)
)
@verifications.add('full_task_graph')
def verify_dependency_tiers(task, taskgraph, scratch_pad):
tiers = scratch_pad