# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import itertools import logging import os import re from datetime import datetime, timedelta
from redo import retry from taskcluster.exceptions import TaskclusterRestFailure from taskgraph import create from taskgraph.target_tasks import filter_for_git_branch, register_target_task from taskgraph.util.attributes import attrmatch from taskgraph.util.parameterization import resolve_timestamps from taskgraph.util.taskcluster import (
find_task_id,
get_artifact,
get_task_definition,
parse_time,
) from taskgraph.util.yaml import load_yaml
from gecko_taskgraph import GECKO, TEST_CONFIGS from gecko_taskgraph.util.attributes import (
match_run_on_hg_branches,
match_run_on_projects,
match_run_on_repo_type,
) from gecko_taskgraph.util.constants import TEST_KINDS from gecko_taskgraph.util.hg import find_hg_revision_push_info, get_hg_commit_message from gecko_taskgraph.util.platforms import platform_family from gecko_taskgraph.util.taskcluster import find_task, insert_index
logger = logging.getLogger(__name__)
# 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.
UNCOMMON_TRY_TASK_LABELS = [ # Platforms and/or Build types
r"build-.*-gcp", # Bug 1631990
r"mingwclang", # Bug 1631990
r"valgrind", # Bug 1631990 # Android tasks
r"android-geckoview-docs",
r"android-hw", # Windows tasks
r"windows11-64-24h2-hw-ref",
r"windows10-aarch64-qr", # Test tasks
r"web-platform-tests.*backlog", # hide wpt jobs that are not implemented yet - bug 1572820
r"-artifact[/-]", # Artifact build test jobs - Bug 1945658
r"-ccov",
r"-profiling-", # talos/raptor profiling jobs are run too often
r"-32-.*-webgpu", # webgpu gets little benefit from these tests.
r"-asan-.*-webgpu",
r"-tsan-.*-webgpu", # Hide shippable versions of tests we have opt versions of because the non-shippable # versions are faster to run. This is mostly perf tests.
r"-shippable(?!.*(awsy|browsertime|marionette-headless|mochitest-devtools-chrome-fis|raptor|talos|web-platform-tests-wdspec-headless|mochitest-plain-headless))", # noqa - too long
r"nightly-simulation", # Can't actually run on try
r"notarization", # not usually needed "upload-symbols",
]
def index_exists(index_path, reason=""):
print(f"Looking for existing index {index_path} {reason}...") try:
task_id = find_task_id(index_path)
print(f"Index {index_path} exists: taskId {task_id}") returnTrue except (KeyError, TaskclusterRestFailure) as e: if isinstance(e, TaskclusterRestFailure) and e.status_code != 404: raise
print(f"Index {index_path} doesn't exist.") returnFalse
def filter_out_shipping_phase(task, parameters): return ( # nightly still here because of geckodriver not task.attributes.get("nightly") and task.attributes.get("shipping_phase") in (None, "build")
)
def filter_out_cron(task, parameters): """
Filter out tasks that run via cron. """ returnnot task.attributes.get("cron")
def filter_for_repo_type(task, parameters): """Filter tasks by repository type.
This filter is temporarily in-place to facilitate the hg.mozilla.org ->
Github migration."""
run_on_repo_types = set(task.attributes.get("run_on_repo_type", ["git", "hg"])) return match_run_on_repo_type(parameters["repository_type"], run_on_repo_types)
def filter_for_hg_branch(task, parameters): """Filter tasks by hg branch. If `run_on_hg_branch` isnot defined, then task runs on all branches"""
run_on_hg_branches = set(task.attributes.get("run_on_hg_branches", ["all"])) return match_run_on_hg_branches(parameters["hg_branch"], run_on_hg_branches)
def filter_on_platforms(task, platforms): """Filter tasks on the given platform"""
platform = task.attributes.get("build_platform") return platform in platforms
def filter_by_uncommon_try_tasks(task, optional_filters=None): """Filters tasks that should not be commonly run on try.
Args:
task (str): String representing the task name.
optional_filters (list, optional):
Additional filters to apply to task filtering.
Returns:
(Boolean): Trueif task does not match any known filters. False otherwise. """
filters = UNCOMMON_TRY_TASK_LABELS if optional_filters:
filters = itertools.chain(filters, optional_filters)
returnnot any(re.search(pattern, task) for pattern in filters)
def filter_by_regex(task_label, regexes, mode="include"): """Filters tasks according to a list of pre-compiled reguar expressions.
If mode is"include", a task label must match any regex to pass. If it is"exclude", a task label must _not_ match any regex to pass. """ ifnot regexes: returnTrue
assert mode in ["include", "exclude"]
any_match = any(r.search(task_label) for r in regexes) if any_match: return mode == "include" return mode != "include"
def filter_release_tasks(task, parameters):
platform = task.attributes.get("build_platform") if platform in ( "linux64", "linux64-aarch64", "macosx64", "win32", "win64", "win64-aarch64",
): if task.attributes["kind"] == "l10n": # This is on-change l10n returnTrue if (
task.attributes["build_type"] == "opt" and task.attributes.get("unittest_suite") != "talos" and task.attributes.get("unittest_suite") != "raptor"
): returnFalse
if task.attributes.get("shipping_phase") notin (None, "build"): returnFalse
""" No debug on release, keep on ESR with 4 week cycles, release
will not be too different from central, but ESR will live for a long time.
From June 2019 -> June 2020, we found 1 unique regression on ESR debug and5 unique regressions on beta/release. Keeping spidermonkey and linux
debug finds all but 1 unique regressions (windows found on try) for beta/release.
...but debug-only failures started showing up on ESR (esr-91, esr-102) so
desktop debug tests were added back for beta. """
build_type = task.attributes.get("build_type", "")
build_platform = task.attributes.get("build_platform", "")
test_platform = task.attributes.get("test_platform", "")
if parameters["release_type"].startswith("esr") or (
parameters["release_type"] == "beta"and"android"notin build_platform
): returnTrue
# code below here is intended to reduce release debug tasks if task.kind == "hazard"or"toolchain"in build_platform: # keep hazard and toolchain builds around returnTrue
if build_type == "debug": if"linux"notin build_platform: # filter out windows/mac/android returnFalse if task.kind notin ["spidermonkey"] and"-qr"in test_platform: # filter out linux-qr tests, leave spidermonkey returnFalse if"64"notin build_platform: # filter out linux32 builds returnFalse
# webrender-android-*-debug doesn't have attributes to find 'debug', using task.label. if task.kind == "webrender"and"debug"in task.label: returnFalse returnTrue
def filter_tests_without_manifests(task, parameters): """Remove test tasks that have an empty 'test_manifests' attribute.
This situation can arise when the test loader (e.g bugbug) decided there
weren't any important manifests to run for the given push. We filter tasks
out here rather than in the transforms so that the full task graph is still
aware that the task exists (which is needed by the backfill action). """ if (
task.kind in TEST_KINDS and"test_manifests"in task.attributes andnot task.attributes["test_manifests"]
): returnFalse returnTrue
def standard_filter(task, parameters): return all(
filter_func(task, parameters) for filter_func in (
filter_out_cron,
filter_for_repo_type,
filter_for_project,
filter_for_hg_branch,
filter_for_git_branch,
filter_tests_without_manifests,
)
)
def _try_task_config(full_task_graph, parameters, graph_config):
requested_tasks = parameters["try_task_config"]["tasks"]
pattern_tasks = [x for x in requested_tasks if x.endswith("-*")]
tasks = list(set(requested_tasks) - set(pattern_tasks))
matched_tasks = []
missing = set() for pattern in pattern_tasks:
prefix = pattern.replace("*", "")
found = [
t for t in full_task_graph.graph.nodes if t.split(prefix)[-1].isnumeric()
] ifnot found: # When dynamic chunking produces 1 chunk, the label has no # numeric suffix (e.g. "test-...-xpcshell" instead of # "test-...-xpcshell-1"). Match the unchunked name too.
base = prefix.rstrip("-") if base in full_task_graph.graph.nodes:
found = [base] if found:
matched_tasks.extend(found) else:
missing.add(pattern)
if"MOZHARNESS_TEST_PATHS"in parameters["try_task_config"].get("env", {}):
matched_tasks = [
x for x in matched_tasks if x.endswith("-1") ornot x.rsplit("-", 1)[-1].isnumeric()
]
if"MOZHARNESS_TEST_TAG"in parameters["try_task_config"].get("env", {}):
matched_tasks = [
x for x in matched_tasks if x.endswith("-1") ornot x.rsplit("-", 1)[-1].isnumeric()
]
if missing:
missing_str = "\n ".join(sorted(missing))
logger.warning(
f"The following tasks were requested but do not exist in the full task graph and will be skipped:\n {missing_str}"
) return list(selected_tasks - missing)
@register_target_task("try_tasks") def target_tasks_try(full_task_graph, parameters, graph_config):
try_mode = parameters["try_mode"] if try_mode == "try_task_config": return _try_task_config(full_task_graph, parameters, graph_config) # With no try mode, we schedule nothing, allowing the user to add tasks # later via treeherder. return []
@register_target_task("default") def target_tasks_default(full_task_graph, parameters, graph_config): """Target the tasks which have indicated they should be run on this project
via the `run_on_projects` attributes.""" return [
l for l, t in full_task_graph.tasks.items() if standard_filter(t, parameters) and filter_out_shipping_phase(t, parameters) and filter_out_devedition(t, parameters)
]
@register_target_task("autoland_tasks") def target_tasks_autoland(full_task_graph, parameters, graph_config): """In addition to doing the filtering by project that the 'default'
filter does, also remove any tests running against shippable builds for non-backstop pushes."""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task): if task.kind notin TEST_KINDS: returnTrue
if parameters["backstop"]: returnTrue
build_type = task.attributes.get("build_type")
ifnot build_type or build_type != "opt"or filter_out_shippable(task): returnTrue
returnFalse
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@register_target_task("mozilla_central_tasks") def target_tasks_mozilla_central(full_task_graph, parameters, graph_config): """In addition to doing the filtering by project that the 'default'
filter does, also remove any tests running against regular (aka not shippable,
asan, etc.) opt builds."""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task): if task.kind notin TEST_KINDS: returnTrue
family = platform_family(build_platform) # We need to know whether this test is against a "regular" opt build # (which is to say, not shippable, asan, tsan, or any other opt build # with other properties). There's no positive test for this, so we have to # do it somewhat hackily. Android doesn't have variants other than shippable # so it is pretty straightforward to check for. Other platforms have many # variants, but none of the regular opt builds we're looking for have a "-" # in their platform name, so this works (for now).
is_regular_opt = (
family == "android"andnot shippable
) or"-"notin build_platform
if build_type != "opt"ornot is_regular_opt: returnTrue
returnFalse
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@register_target_task("enterprise_firefox_tasks") def target_tasks_enterprise_firefox(full_task_graph, parameters, graph_config): """
Filter to run Enterprise-specific builds, i.e., those allowed to run from
GitHub repos and that matches the "enterprise-firefox" project. """
filtered_for_enterprise = target_tasks_enterprise_firefox_with_tests(
full_task_graph, parameters, graph_config
)
def filter(task): if task.kind in TEST_KINDS: returnFalse
returnTrue
return [l for l in filtered_for_enterprise if filter(full_task_graph[l])]
@register_target_task("enterprise_firefox_with_tests_tasks") def target_tasks_enterprise_firefox_with_tests(
full_task_graph, parameters, graph_config
): """
Filter to run Enterprise-specific builds, i.e., those allowed to run from
GitHub repos and that matches the "enterprise-firefox" project. """
def filter(task):
test_platform = task.attributes.get("test_platform") # Skip android-hw tests, windows11-aarch64: they require special hardware and credentials if ( "test"in task.kind and test_platform and ("android-hw"in test_platform or"windows11-aarch64"in test_platform)
): returnFalse
# Only keep builds that have been explicitely flagged if task.kind == "build"andnot"enterprise-firefox"in task.attributes.get( "run_on_projects"
): returnFalse
if task.attributes.get("shipping_product") notin (None, "firefox-enterprise"): returnFalse
level = int(parameters["level"]) if level < 3: if"shippable"in task.label or shippable: returnFalse
if task.kind == "complete": returnFalse
if build_platform and"enterprise"notin build_platform: returnFalse
if test_platform and"enterprise"notin test_platform: returnFalse
ifnot build_platform ornot build_type: returnTrue
if shippable and"enterprise"notin build_platform: returnFalse
family = platform_family(build_platform) # We need to know whether this test is against a "regular" opt build # (which is to say, not shippable, asan, tsan, or any other opt build # with other properties). There's no positive test for this, so we have to # do it somewhat hackily. Android doesn't have variants other than shippable # so it is pretty straightforward to check for. Other platforms have many # variants, but none of the regular opt builds we're looking for have a "-" # in their platform name, so this works (for now).
is_regular_opt = (
family == "android"andnot shippable
) or"-"notin build_platform
if build_type != "opt"ornot is_regular_opt: returnTrue
returnFalse
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@register_target_task("graphics_tasks") def target_tasks_graphics(full_task_graph, parameters, graph_config): """In addition to doing the filtering by project that the 'default'
filter does, also remove artifact builds because we have csets on
the graphics branch that aren't on the candidate branches of artifact
builds"""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task): if task.attributes["kind"] == "artifact-build": returnFalse returnTrue
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@register_target_task("mozilla_beta_tasks")
@register_target_task("mozilla_release_tasks") def target_tasks_mozilla_release(full_task_graph, parameters, graph_config): """Select the set of tasks required for a promotable beta or release build
of desktop, plus android CI. The candidates build process involves a pipeline
of builds and signing, but does not include beetmover or balrog jobs."""
return [
l for l, t in full_task_graph.tasks.items() if filter_release_tasks(t, parameters) and standard_filter(t, parameters)
]
@register_target_task("mozilla_esr153_tasks")
@register_target_task("mozilla_esr140_tasks") def target_tasks_mozilla_esr(full_task_graph, parameters, graph_config): """Select the set of tasks required for a promotable beta or release build
of desktop, without android CI. The candidates build process involves a pipeline
of builds and signing, but does not include beetmover or balrog jobs."""
# Android is not built on esr. if platform and"android"in platform: returnFalse
returnTrue
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("promote_desktop") def target_tasks_promote_desktop(full_task_graph, parameters, graph_config): """Select the superset of tasks required to promote a beta or release build
of a desktop product. This should include all non-android
mozilla_{beta,release} tasks, plus l10n, beetmover, balrog, etc."""
def filter(task): if task.attributes.get("shipping_product") != parameters["release_product"]: returnFalse
if task.attributes.get("shipping_phase") == "promote": returnTrue
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("push_desktop") def target_tasks_push_desktop(full_task_graph, parameters, graph_config): """Select the set of tasks required to push a build of desktop to cdns.
Previous build deps will be optimized out via action task."""
filtered_for_candidates = target_tasks_promote_desktop(
full_task_graph,
parameters,
graph_config,
)
def filter(task): # Include promotion tasks; these will be optimized out if task.label in filtered_for_candidates: returnTrue
if (
task.attributes.get("shipping_product") == parameters["release_product"] and task.attributes.get("shipping_phase") == "push"
): returnTrue
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("ship_desktop") def target_tasks_ship_desktop(full_task_graph, parameters, graph_config): """Select the set of tasks required to ship desktop.
Previous build deps will be optimized out via action task."""
filtered_for_candidates = target_tasks_push_desktop(
full_task_graph,
parameters,
graph_config,
)
def filter(task): # Include promotion tasks; these will be optimized out if task.label in filtered_for_candidates: returnTrue
if (
task.attributes.get("shipping_product") == parameters["release_product"] and task.attributes.get("shipping_phase") == "ship"
): returnTrue
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
def filter(task): # bug 1899403: no need for android tasks if"android"in task.attributes.get("build_platform", ""): returnFalse returnTrue
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@register_target_task("pine_tasks") def target_tasks_pine(full_task_graph, parameters, graph_config): """Bug 1879960 - no reftests or wpt needed"""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task): if"android"in task.attributes.get("build_platform", ""): returnFalse
suite = task.attributes.get("unittest_suite", "") if"reftest"in suite or"web-platform"in suite: returnFalse returnTrue
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@register_target_task("larch_tasks") def target_tasks_larch(full_task_graph, parameters, graph_config): """Bug 1879213 - only run necessary tasks on larch"""
filtered_for_project = target_tasks_default(
full_task_graph, parameters, graph_config
)
def filter(task): # no localized builds, no android if ( "l10n"in task.kind or"msix"in task.kind or"android"in task.attributes.get("build_platform", "") or (task.kind == "test"and"msix"in task.label)
): returnFalse # otherwise reduce tests only if task.kind notin TEST_KINDS: returnTrue return"browser-chrome"in task.label or"xpcshell"in task.label
return [l for l in filtered_for_project if filter(full_task_graph[l])]
@register_target_task("kaios_tasks") def target_tasks_kaios(full_task_graph, parameters, graph_config): """The set of tasks to run for kaios integration"""
def filter(task): # We disable everything in central, and adjust downstream. returnFalse
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("custom-car_perf_testing") def target_tasks_custom_car_perf_testing(full_task_graph, parameters, graph_config): """Select tasks required for running daily performance tests for custom chromium-as-release."""
# Bug 2014270 - Disable speedometer2 on production branches if"speedometer2"in try_name: returnFalse
# Desktop and Android selection for CaR if accept_raptor_desktop_build(platform): if"browsertime"in try_name and"custom-car"in try_name: # Bug 1898514: avoid tp6m or non-essential tp6 jobs in cron if"tp6"in try_name and"essential"notin try_name: returnFalse # Bug 2038340: temporarily limit CaR benchmarks on Windows # to sp3/js3/motionmark during PSU replacement if"windows"in platform and"benchmark"in try_name: ifnot any(
x in try_name for x in ["speedometer3", "jetstream3", "motionmark"]
): returnFalse # Bug 1928416 # For ARM coverage, this will only run on M2 machines at the moment. if"jetstream2"in try_name: # Bug 1963732 - Disable js2 on 1500 mac for custom-car due to near perma if"m-car"in try_name and"1500"in platform: returnFalse returnTrue returnTrue elif accept_raptor_android_build(platform): if"browsertime"in try_name and"cstm-car-m"in try_name: if"-nofis"notin try_name: returnFalse if"hw-s24"in platform and"speedometer3"notin try_name: returnFalse if"jetstream2"in try_name: returnTrue if"jetstream3"in try_name: returnTrue # Bug 1898514 - Avoid tp6m or non-essential tp6 jobs in cron on non-a55 platform # Bug 1961831 - Disable pageload tests temporarily during provider switch if"tp6m"in try_name: returnFalse # Bug 1945165 - Disable ebay-kleinanzeigen on cstm-car-m because of permafail if ( "ebay-kleinanzeigen"in try_name and"ebay-kleinanzeigen-search"notin try_name
): returnFalse # Bug 1960921 Disable ebay-kleinanzeigen-search-nofis on custom-car if"ebay-kleinanzeigen-search-nofis"in try_name: returnFalse returnTrue returnFalse
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("general_perf_testing") def target_tasks_general_perf_testing(full_task_graph, parameters, graph_config): """
Select tasks required for running performance tests 3 times a week. """
try_name = attributes.get("raptor_try_name") if accept_raptor_desktop_build(platform): if ( "browsertime"in try_name and"speedometer3"in try_name and"chrome"in try_name
): returnTrue if accept_raptor_android_build(platform): if"hw-s24"in platform and"speedometer3"notin try_name: returnFalse if ( "browsertime"in try_name and"speedometer3"in try_name and"chrome-m"in try_name
): if"-nofis"notin try_name: returnFalse returnTrue
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("nightly_linux") def target_tasks_nightly_linux(full_task_graph, parameters, graph_config): """Select the set of tasks required for a nightly build of linux. The
nightly build process involves a pipeline of builds, signing, and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({ "linux64-shippable", "linux64-aarch64-shippable",
}) return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@register_target_task("nightly_macosx") def target_tasks_nightly_macosx(full_task_graph, parameters, graph_config): """Select the set of tasks required for a nightly build of macosx. The
nightly build process involves a pipeline of builds, signing, and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"macosx64-shippable"}) return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@register_target_task("nightly_win32") def target_tasks_nightly_win32(full_task_graph, parameters, graph_config): """Select the set of tasks required for a nightly build of win32 and win64.
The nightly build process involves a pipeline of builds, signing, and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"win32-shippable"}) return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@register_target_task("nightly_win64") def target_tasks_nightly_win64(full_task_graph, parameters, graph_config): """Select the set of tasks required for a nightly build of win32 and win64.
The nightly build process involves a pipeline of builds, signing, and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"win64-shippable"}) return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@register_target_task("nightly_win64_aarch64") def target_tasks_nightly_win64_aarch64(full_task_graph, parameters, graph_config): """Select the set of tasks required for a nightly build of win32 and win64.
The nightly build process involves a pipeline of builds, signing, and, eventually, uploading the tasks to balrog."""
filter = make_desktop_nightly_filter({"win64-aarch64-shippable"}) return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@register_target_task("daily_releases") def target_tasks_daily_releases(full_task_graph, parameters, graph_config): """Select the set of tasks required to identify if we should release. If we determine that we should the task will communicate to ship-it to
schedule the release itself."""
def filter(task): return task.kind in ["maybe-release"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("nightly_desktop") def target_tasks_nightly_desktop(full_task_graph, parameters, graph_config): """Select the set of tasks required for a nightly build of linux, mac,
windows.""" for platform in ("desktop", "all"):
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-nightly-{platform}"
) if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={ "reason": "to avoid triggering multiple nightlies off the same revision",
},
): return []
# Tasks that aren't platform specific
release_filter = make_desktop_nightly_filter({None})
release_tasks = [
l for l, t in full_task_graph.tasks.items() if release_filter(t, parameters)
] # Avoid duplicate tasks. return list(
set(target_tasks_nightly_win32(full_task_graph, parameters, graph_config))
| set(target_tasks_nightly_win64(full_task_graph, parameters, graph_config))
| set(
target_tasks_nightly_win64_aarch64(
full_task_graph, parameters, graph_config
)
)
| set(target_tasks_nightly_macosx(full_task_graph, parameters, graph_config))
| set(target_tasks_nightly_linux(full_task_graph, parameters, graph_config))
| set(release_tasks)
)
@register_target_task("nightly_all") def target_tasks_nightly_all(full_task_graph, parameters, graph_config): """Select the set of tasks required for a nightly build of firefox desktop and android"""
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-nightly-all"
) if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={ "reason": "to avoid triggering multiple nightlies off the same revision",
},
): return []
# Run Searchfox analysis once daily.
@register_target_task("searchfox_index") def target_tasks_searchfox(full_task_graph, parameters, graph_config): """Select tasks required for indexing Firefox for Searchfox web site each day"""
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.searchfox-index"
) if os.environ.get("MOZ_AUTOMATION"):
print(
f"Looking for existing index {index_path} to avoid triggering redundant indexing off the same revision..."
) try:
task = find_task(index_path)
print(f"Index {index_path} exists: taskId {task['taskId']}") except TaskclusterRestFailure as e: if e.status_code != 404: raise
print(f"Index {index_path} doesn't exist.") else: # Find the earlier expiration time of existing tasks
taskdef = get_task_definition(task["taskId"]) try:
task_graph = get_artifact(task["taskId"], "public/task-graph.json") except TaskclusterRestFailure as e: if e.status_code != 404: raise
task_graph = None if task_graph:
base_time = parse_time(taskdef["created"])
first_expiry = min(
resolve_timestamps(base_time, t["task"]["expires"]) for t in task_graph.values()
)
expiry = parse_time(first_expiry) if expiry > datetime.utcnow() + timedelta(days=7):
print("Skipping index tasks") return [] ifnot create.testing:
insert_index(index_path, os.environ["TASK_ID"])
# Run build linux64-plain-clang-trunk/opt on mozilla-central/beta with perf tests
@register_target_task("linux64_clang_trunk_perf") def target_tasks_build_linux64_clang_trunk_perf(
full_task_graph, parameters, graph_config
): """Select tasks required to run perf test on linux64 build with clang trunk"""
# Only keep tasks generated from platform `linux2404-64-clang-trunk/opt` def filter(task_label): # Bug 1961141 - Disable unity webgl for linux1804-64-clang-trunk-qr # (changed to linux2404-64-clang-trunk since then) if"linux2404-64-clang-trunk/opt"in task_label and"unity"in task_label: returnFalse if"linux2404-64-clang-trunk/opt"in task_label and"live"notin task_label: returnTrue returnFalse
return [l for l, t in full_task_graph.tasks.items() if filter(t.label)]
# Run Updatebot's cron job 4 times daily.
@register_target_task("updatebot_cron") def target_tasks_updatebot_cron(full_task_graph, parameters, graph_config): """Select tasks required to run Updatebot's cron job""" return ["updatebot-cron"]
@register_target_task("customv8_update") def target_tasks_customv8_update(full_task_graph, parameters, graph_config): """Select tasks required for building latest d8/v8 version.""" return ["toolchain-linux64-custom-v8"]
@register_target_task("file_update") def target_tasks_file_update(full_task_graph, parameters, graph_config): """Select the set of tasks required to perform periodic in-tree file updates""" return ["repo-update-periodic-file-update"]
@register_target_task("pinning_update") def target_tasks_pinning_update(full_task_graph, parameters, graph_config): """Select the set of tasks required to perform periodic HSTS/HPKP pinning updates""" return ["repo-update-pinning-update"]
@register_target_task("l10n_bump") def target_tasks_l10n_bump(full_task_graph, parameters, graph_config): """Select the set of tasks required to perform l10n bumping."""
def filter(task): # For now any task in the repo-update kind is ok return task.kind in ["l10n-bump"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("merge_automation") def target_tasks_merge_automation(full_task_graph, parameters, graph_config): """Select the set of tasks required to perform repository merges."""
def filter(task): return task.kind in ["merge-automation", "mark-as-merged"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("scriptworker_canary") def target_tasks_scriptworker_canary(full_task_graph, parameters, graph_config): """Select the set of tasks required to run scriptworker canaries."""
def filter(task): # For now any task in the repo-update kind is ok return task.kind in ["scriptworker-canary"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("cron_bouncer_check") def target_tasks_bouncer_check(full_task_graph, parameters, graph_config): """Select the set of tasks required to perform bouncer version verification."""
def filter(task): ifnot filter_for_project(task, parameters): returnFalse # For now any task in the repo-update kind is ok return task.kind in ["cron-bouncer-check"]
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
def _filter_by_release_project(parameters):
project_by_release = { "nightly": "mozilla-central", "beta": "mozilla-beta", "release": "mozilla-release", "esr153": "mozilla-esr153", "esr140": "mozilla-esr140",
}
target_project = project_by_release.get(parameters["release_type"]) if target_project isNone: raise Exception("Unknown or unspecified release type in simulation run.")
# Pretend we're running on the target project for purposes of run-on-projects filtering
params = parameters.copy()
params["project"] = target_project
params["level"] = "3" returnlambda task: filter_for_project(task, params)
@register_target_task("staging_release_builds") def target_tasks_staging_release(full_task_graph, parameters, graph_config): """
Select all builds that are part of releases. """
filter_for_target_project = _filter_by_release_project(parameters)
return [
l for l, t in full_task_graph.tasks.items() if t.attributes.get("shipping_product") and filter_out_android_on_esr(parameters, t) and filter_for_target_project(t) and t.attributes.get("shipping_phase") == "build"
]
@register_target_task("release_simulation") def target_tasks_release_simulation(full_task_graph, parameters, graph_config): """
Select tasks that would run on push on a release branch. """
filter_for_target_project = _filter_by_release_project(parameters)
return [
l for l, t in full_task_graph.tasks.items() if filter_release_tasks(t, parameters) and filter_out_cron(t, parameters) and filter_for_target_project(t) and filter_out_android_on_esr(parameters, t)
]
@register_target_task("codereview") def target_tasks_codereview(full_task_graph, parameters, graph_config): """Select all code review tasks needed to produce a report"""
def filter(task): # Ending tasks if task.kind in ["code-review"]: returnTrue
# Analyzer tasks if task.attributes.get("code-review") isTrue: returnTrue
returnFalse
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("daily_beta_perf") def target_tasks_daily_beta_perf(full_task_graph, parameters, graph_config): """
Select performance tests on the beta branch to be run daily """
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-daily-beta-perf"
) if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={ "reason": "to avoid triggering multiple daily beta perftests off of the same revision",
},
): return []
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("weekly_release_perf") def target_tasks_weekly_release_perf(full_task_graph, parameters, graph_config): """
Select performance tests on the release branch to be run weekly """
if platform and"android"notin platform: returnFalse if attributes.get("unittest_suite") != "raptor": returnFalse
try_name = attributes.get("raptor_try_name") if"-cold"in try_name and"shippable"in platform: # Get browsertime amazon smoke tests if ( "browsertime"in try_name and"amazon"in try_name and"search"notin try_name
): returnTrue
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("backfill_all_browsertime") def target_tasks_backfill_all_browsertime(full_task_graph, parameters, graph_config): """
Search for revisions that contains patches that were reviewed by perftest reviewers and landed the day before the cron is running. Trigger backfill-all-browsertime action
task on each of them. """ from gecko_taskgraph.actions.util import get_decision_task_id, get_pushes
for line in commit_message.split("\n\n"): if line.lower().startswith("bug ") and"r="in line: if"perftest-reviewers"in line.split("r=")[-1]:
print(line) returnTrue returnFalse
pushes = get_pushes(
project=parameters["head_repository"],
end_id=int(parameters["pushlog_id"]),
depth=200,
full_response=True,
) for push_id in sorted([int(p) for p in pushes.keys()], reverse=True):
push_rev = pushes[str(push_id)]["changesets"][-1]
push_info = find_hg_revision_push_info( "https://hg.mozilla.org/integration/" + parameters["project"], push_rev
)
pushdate = int(push_info["pushdate"]) if date_is_yesterday(pushdate) and reviewed_by_perftest(push_rev): from gecko_taskgraph.actions.util import trigger_action
print(
f"Revision {push_rev} was created yesterday and was reviewed by "
f"#perftest-reviewers."
) try:
push_decision_task_id = get_decision_task_id(
parameters["project"], push_id
) except Exception:
print(f"Could not find decision task for push {push_id}") continue try:
trigger_action(
action_name="backfill-all-browsertime", # This lets the action know on which push we want to add a new task
decision_task_id=push_decision_task_id,
) except Exception as e:
print(f"Failed to trigger action for {push_rev}: {e}")
return []
@register_target_task("condprof") def target_tasks_condprof(full_task_graph, parameters, graph_config): """
Select tasks required for building conditioned profiles. """ for name, task in full_task_graph.tasks.items(): if task.kind == "condprof": if"a51"notin name: # bug 1765348 yield name
@register_target_task("system_symbols") def target_tasks_system_symbols(full_task_graph, parameters, graph_config): """
Select tasks for scraping and uploading system symbols. """ for name, task in full_task_graph.tasks.items(): if task.kind in [ "system-symbols", "system-symbols-upload", "system-symbols-reprocess",
]: yield name
@register_target_task("perftest") def target_tasks_perftest(full_task_graph, parameters, graph_config): """
Select perftest tasks we want to run daily """ for name, task in full_task_graph.tasks.items(): if task.kind != "perftest": continue if task.attributes.get("cron", False): yield name
@register_target_task("perftest-fenix-startup") def target_tasks_perftest_fenix_startup(full_task_graph, parameters, graph_config): """
Select perftest tasks we want to run daily for fenix startup """ for name, task in full_task_graph.tasks.items(): if task.kind != "perftest": continue if"fenix"in name and"startup"in name and"profiling"notin name: yield name
@register_target_task("perftest-on-autoland") def target_tasks_perftest_autoland(full_task_graph, parameters, graph_config): """
Select perftest tasks we want to run daily """ for name, task in full_task_graph.tasks.items(): if task.kind != "perftest": continue if task.attributes.get("cron", False) and any(
test_name in name for test_name in ["view"]
): yield name
@register_target_task("retrigger-perftests-autoland") def retrigger_perftests_autoland_commits(full_task_graph, parameters, graph_config): """ In this transform we are trying to do retrigger the following tasks 4 times every 20 commits in autoland:
- "perftest-android-hw-a55-aarch64-shippable-startup-fenix-cold-main-first-frame",
- "perftest-android-hw-a55-aarch64-shippable-startup-fenix-cold-view-nav-start",
- "perftest-android-hw-a55-aarch64-shippable-startup-fenix-homeview-startup",
- "perftest-android-hw-a55-aarch64-shippable-startup-fenix-newssite-applink-startup",
- "perftest-android-hw-a55-aarch64-shippable-startup-fenix-shopify-applink-startup",
- "perftest-android-hw-a55-aarch64-shippable-startup-fenix-tab-restore-shopify"
- "test-windows11-64-24h2-shippable/opt-browsertime-benchmark-firefox-speedometer3", """
retrigger_count = 4 for name, task in full_task_graph.tasks.items(): if (
( "perftest-android-hw-a55-aarch64-shippable-startup-fenix"in task.label and"simple"notin task.label
) or"test-windows11-64-24h2-shippable/opt-browsertime-benchmark-firefox-speedometer3" in task.label
):
task.attributes["task_duplicates"] = retrigger_count yield name
@register_target_task("eslint-build") def target_tasks_eslint_build(full_task_graph, parameters, graph_config): """Select the task to run additional ESLint rules which require a build."""
for name, task in full_task_graph.tasks.items(): if task.kind != "source-test": continue if"eslint-build"in name: yield name
@register_target_task("holly_tasks") def target_tasks_holly(full_task_graph, parameters, graph_config): """Bug 1814661: only run updatebot tasks on holly"""
def filter(task): return task.kind == "updatebot"
return [l for l, t in full_task_graph.tasks.items() if filter(t)]
@register_target_task("snap_upstream_tasks") def target_tasks_snap_upstream_tasks(full_task_graph, parameters, graph_config): """
Select tasks for building/testing Snap package built as upstream. Omit -try
because it does not really make sense on a m-c cron
Use test tasks for linux64 builds and only builds for arm* until there is
support for running tests (bug 1855463) """ for name, task in full_task_graph.tasks.items(): if"snap-upstream"in name andnot"-local"in name: yield name
for platform in ("android", "all"):
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-nightly-{platform}"
) if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={ "reason": "to avoid triggering multiple nightlies off the same revision",
},
): return []
return [l for l, t in full_task_graph.tasks.items() if filter(t, parameters)]
@register_target_task("android-l10n-import") def target_tasks_android_l10n_import(full_task_graph, parameters, graph_config): return [l for l, t in full_task_graph.tasks.items() if l == "android-l10n-import"]
@register_target_task("android-l10n-sync") def target_tasks_android_l10n_sync(full_task_graph, parameters, graph_config): return [l for l, t in full_task_graph.tasks.items() if l == "android-l10n-sync"]
@register_target_task("android-l10n-sync-beta-to-release") def target_tasks_android_l10n_sync_beta_to_release(
full_task_graph, parameters, graph_config
): return [
l for l, t in full_task_graph.tasks.items() if l == "android-l10n-sync-beta-to-release"
]
labels = [] for label, task in full_task_graph.tasks.items(): if task.kind notin TEST_KINDS + ( "source-test", "perftest", "startup-test", "snap-upstream-test",
): continue
# Match tasks against attribute sets defined in os-integration.yml. ifnot any(attrmatch(task.attributes, **c) for c in candidate_attrs): continue
if parameters["try_mode"] isnotNone: # Only run hardware tasks if scheduled from try. We do this because # the `cron` task is designed to provide a base for testing worker # images, which isn't something that impacts our hardware pools. if (
task.attributes.get("build_platform") == "macosx64" or"android-hw"in label
): continue
# The `-local` snap variants depend on local gecko checkouts and # aren't meaningful on m-c; match the exclusion used by # `snap_upstream_tasks`. if task.kind == "snap-upstream-test"and"-local"in label: continue
# Perform additional filtering for non-try repos. We don't want to # limit what can be scheduled on try as os-integration tests are still # useful for manual verification of things. ifnot (
filter_for_project(task, parameters) and filter_for_hg_branch(task, parameters) and filter_tests_without_manifests(task, parameters)
): continue
labels = [] for label, task in full_task_graph.tasks.items(): # Always add the code review analysis & ending tasks if task.attributes.get("code-review") or task.kind == "code-review":
labels.append(label)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.