Bug 1630350 - apply mach try filter to try syntax selector r=jmaher,gbrown

Changes:

Applies the `filter_tasks_by_blacklist` method to try syntax pushes as well.

  - moved `TARGET_TASK_BLACKLIST`and `filter_tasks_by_blacklist` method to live in `taskcluster/taskgraph/target_tasks.py`.
  - removed existing filters against `ccov, windows10-aarch64` and `android-hw` filters against try syntax pushes.
  - update imports for `fuzzy` and `chooser` selectors to refer to the new location of `filter_tasks_by_blacklist` method.

The reason for moving the logic (again) from `tools/tryselect` to `taskcluster/` is due to the placement of `try_option_syntax` and `target_tasks` files and both of those files handle the processing of `mach try syntax` pushes.

Differential Revision: https://phabricator.services.mozilla.com/D71698
This commit is contained in:
Edwin Takahashi
2020-04-21 19:51:25 +00:00
parent 2a791bee23
commit e6fb8f6642
5 changed files with 39 additions and 43 deletions

View File

@@ -6,12 +6,29 @@
from __future__ import absolute_import, print_function, unicode_literals
from re import search
from taskgraph import try_option_syntax
from taskgraph.parameters import Parameters
from taskgraph.util.attributes import match_run_on_projects, match_run_on_hg_branches
_target_task_methods = {}
# Some tasks show up in the target task set, but are possibly special cases,
# uncommon tasks, or tasks running against limited hardware set that they
# should only be selectable with --full.
TARGET_TASK_BLACKLIST = [
r'-ccov/',
r'windows10-aarch64/opt',
r'win64-aarch64-laptop',
r'windows10-64-ref-hw-2017',
r'android-hw',
r'android-geckoview-docs',
r'linux1804-32', # hide linux32 tests - bug 1599197
r'linux-', # hide all linux32 tasks by default - bug 1599197
r'linux.*web-platform-tests.*-fis-', # hide wpt linux fission tests - bug 1610879
]
def _target_task(name):
def wrap(func):
@@ -58,6 +75,23 @@ def filter_on_platforms(task, platforms):
return (platform in platforms)
def filter_tasks_by_blacklist(task, optional_filters=None):
"""Filters tasks based on blacklist rules.
Args:
task (str): String representing the task name.
Returns:
(Boolean): True if task does not match any known filters.
False otherwise.
"""
if optional_filters:
for item in optional_filters:
TARGET_TASK_BLACKLIST.append(item)
return not any(search(pattern, task) for pattern in TARGET_TASK_BLACKLIST)
def filter_release_tasks(task, parameters):
platform = task.attributes.get('build_platform')
if platform in (
@@ -111,7 +145,7 @@ def _try_option_syntax(full_task_graph, parameters, graph_config):
parameters['message'] and, for context, the full task graph."""
options = try_option_syntax.TryOptionSyntax(parameters, full_task_graph, graph_config)
target_tasks_labels = [t.label for t in full_task_graph.tasks.itervalues()
if options.task_matches(t)]
if options.task_matches(t) and filter_tasks_by_blacklist(t.label)]
attributes = {
k: getattr(options, k) for k in [