Bug 1795921 - [taskgraph] Use an 'enable_always_target' param to control when 'always_target' should apply, r=releng-reviewers,gbrown

This is a bit more general purpose and flexible than hardcoding `hg-push` here.
It is also something that can be upstreamed to standalone taskgraph.

Differential Revision: https://phabricator.services.mozilla.com/D160536
This commit is contained in:
Andrew Halberstadt 2022-10-31 13:14:23 +00:00
Родитель 80d9810bbf
Коммит 92f0b6ef83
7 изменённых файлов: 15 добавлений и 2 удалений

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

@ -134,6 +134,13 @@ those in the target set, recursively. In a decision task, this set can be
specified programmatically using one of a variety of methods (e.g., parsing try
syntax or reading a project-specific configuration file).
``enable_always_target``
When ``True``, any task with the ``always_target`` attribute will be
included in the ``target_task_graph`` regardless of whether they were
filtered out by the ``target_tasks_method`` or not. Because they are not
part of the ``target_set``, they will still be eligible for optimization
when the ``optimize_target_tasks`` parameter is ``False``.
``filters``
List of filter functions (from ``taskcluster/gecko_taskgraph/filter_tasks.py``) to
apply. This is usually defined internally, as filters are typically

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

@ -52,6 +52,7 @@ ARTIFACTS_DIR = "artifacts"
# See `taskcluster/docs/parameters.rst` for information on parameters.
PER_PROJECT_PARAMETERS = {
"try": {
"enable_always_target": True,
"target_tasks_method": "try_tasks",
},
"kaios-try": {
@ -336,6 +337,7 @@ def get_decision_parameters(graph_config, options):
parameters["filters"] = [
"target_tasks_method",
]
parameters["enable_always_target"] = False
parameters["existing_tasks"] = {}
parameters["do_not_optimize"] = []
parameters["build_number"] = 1

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

@ -359,7 +359,7 @@ class TaskGraphGenerator:
if t.attributes["kind"] == "docker-image"
}
# include all tasks with `always_target` set
if parameters["tasks_for"] == "hg-push":
if parameters["enable_always_target"]:
always_target_tasks = {
t.label
for t in full_task_graph.tasks.values()

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

@ -20,6 +20,7 @@ gecko_parameters_schema = {
Required("app_version"): str,
Required("backstop"): bool,
Required("build_number"): int,
Required("enable_always_target"): bool,
Required("hg_branch"): str,
Required("message"): str,
Required("next_version"): Any(None, str),
@ -67,6 +68,7 @@ def get_defaults(repo_root=None):
"backstop": False,
"base_repository": "https://hg.mozilla.org/mozilla-unified",
"build_number": 1,
"enable_always_target": False,
"head_repository": "https://hg.mozilla.org/mozilla-central",
"hg_branch": "default",
"message": "",

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

@ -158,6 +158,7 @@ def maketgg(monkeypatch):
{
"_kinds": kinds,
"backstop": False,
"enable_always_target": False,
"target_tasks_method": "test_method",
"test_manifest_loader": "default",
"try_mode": None,

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

@ -90,7 +90,7 @@ def test_always_target_tasks(maketgg):
},
),
],
"params": {"optimize_target_tasks": False},
"params": {"optimize_target_tasks": False, "enable_always_target": True},
}
tgg = maketgg(**tgg_args)
assert sorted(tgg.target_task_set.tasks.keys()) == sorted(

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

@ -6,6 +6,7 @@ app_version: 60.0a1
version: 60.0a1
next_version: null
do_not_optimize: []
enable_always_target: true
existing_tasks: {}
filters:
- target_tasks_method