Bug 1921813 - Update verify_routes_notification_filters to align with Taskcluster > 37.5.0. r=taskgraph-reviewers,ahal a=release DONTBUILD

PR #3662 introduced `on-defined`, `on-pending` and `on-running`,
and deprecated `on-any` in favor of `on-transition` or `on-resolved`.

[jcristau: ported fix from https://github.com/taskcluster/taskgraph/pull/500]

Differential Revision: https://phabricator.services.mozilla.com/D224138
This commit is contained in:
Rob Lemley 2024-10-01 15:27:03 +00:00
parent 01e6bd053c
commit 233dc38e35

View file

@ -7,6 +7,7 @@ import logging
import os
import re
import sys
import warnings
import attr
from taskgraph.util.treeherder import join_symbol
@ -211,7 +212,17 @@ def verify_routes_notification_filters(
if task is None:
return
route_prefix = "notify."
valid_filters = ("on-any", "on-completed", "on-failed", "on-exception")
valid_filters = (
"on-any",
"on-completed",
"on-defined",
"on-failed",
"on-exception",
"on-pending",
"on-resolved",
"on-running",
"on-transition",
)
task_dict = task.task
routes = task_dict.get("routes", [])
@ -225,6 +236,13 @@ def verify_routes_notification_filters(
task.label, route_filter
)
)
if route_filter == "on-any":
warnings.warn(
DeprecationWarning(
f"notification filter '{route_filter}' is deprecated. Use "
"'on-transition' or 'on-resolved'."
)
)
@verifications.add("full_task_graph")