diff --git a/taskcluster/taskgraph/target_tasks.py b/taskcluster/taskgraph/target_tasks.py index 328125bdafba..f2d33829da04 100644 --- a/taskcluster/taskgraph/target_tasks.py +++ b/taskcluster/taskgraph/target_tasks.py @@ -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 [ diff --git a/taskcluster/taskgraph/try_option_syntax.py b/taskcluster/taskgraph/try_option_syntax.py index d545640448e2..a31281c68231 100644 --- a/taskcluster/taskgraph/try_option_syntax.py +++ b/taskcluster/taskgraph/try_option_syntax.py @@ -561,18 +561,6 @@ class TryOptionSyntax(object): return False return set(['try', 'all']) & set(attr('run_on_projects', [])) - # Don't schedule code coverage when try option syntax is used - if 'ccov' in attr('build_platform', []): - return False - - # Don't schedule tasks for windows10-aarch64 unless try fuzzy is used - if 'windows10-aarch64' in attr("test_platform", ""): - return False - - # Don't schedule android-hw tests when try option syntax is used - if 'android-hw' in task.label: - return False - # Don't schedule fission tests when try option syntax is used if attr('unittest_variant') == 'fission': return False diff --git a/tools/tryselect/selectors/chooser/__init__.py b/tools/tryselect/selectors/chooser/__init__.py index 0e5f64323693..4e003314799c 100644 --- a/tools/tryselect/selectors/chooser/__init__.py +++ b/tools/tryselect/selectors/chooser/__init__.py @@ -12,7 +12,7 @@ from tryselect.cli import BaseTryParser from tryselect.push import check_working_directory, generate_try_task_config, push_to_try from tryselect.tasks import generate_tasks -from ...tasks import filter_tasks_by_blacklist +from taskgraph.target_tasks import filter_tasks_by_blacklist here = os.path.abspath(os.path.dirname(__file__)) diff --git a/tools/tryselect/selectors/fuzzy.py b/tools/tryselect/selectors/fuzzy.py index cce313cc7bd0..00fe4109a620 100644 --- a/tools/tryselect/selectors/fuzzy.py +++ b/tools/tryselect/selectors/fuzzy.py @@ -17,10 +17,12 @@ from mozboot.util import get_state_dir from mozterm import Terminal from ..cli import BaseTryParser -from ..tasks import generate_tasks, filter_tasks_by_paths, filter_tasks_by_blacklist +from ..tasks import generate_tasks, filter_tasks_by_paths from ..push import check_working_directory, push_to_try, generate_try_task_config from ..util.manage_estimates import download_task_history_data, make_trimmed_taskgraph_cache +from taskgraph.target_tasks import filter_tasks_by_blacklist + terminal = Terminal() here = os.path.abspath(os.path.dirname(__file__)) diff --git a/tools/tryselect/tasks.py b/tools/tryselect/tasks.py index c511e4c53264..bf4e4ac99921 100644 --- a/tools/tryselect/tasks.py +++ b/tools/tryselect/tasks.py @@ -26,21 +26,6 @@ from taskgraph.taskgraph import TaskGraph here = os.path.abspath(os.path.dirname(__file__)) build = MozbuildObject.from_environment(cwd=here) -# 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_FILTERS = ( - 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 -) - PARAMETER_MISMATCH = """ ERROR - The parameters being used to generate tasks differ from those expected by your working copy: @@ -124,19 +109,6 @@ def generate_tasks(params=None, full=False): return tg_target -def filter_tasks_by_blacklist(task): - """Checks task label against known task filters. - - Args: - task (str): String representing the task name. - - Returns: - (Boolean): True if task does not match any known filters. - False otherwise. - """ - return not any(re.search(pattern, task) for pattern in TARGET_TASK_FILTERS) - - def filter_tasks_by_paths(tasks, paths): resolver = TestResolver.from_environment(cwd=here) run_suites, run_tests = resolver.resolve_metadata(paths)