diff --git a/taskcluster/docs/parameters.rst b/taskcluster/docs/parameters.rst index 7f787d2ee8ef..2df1ac403237 100644 --- a/taskcluster/docs/parameters.rst +++ b/taskcluster/docs/parameters.rst @@ -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 diff --git a/taskcluster/gecko_taskgraph/decision.py b/taskcluster/gecko_taskgraph/decision.py index 061b4a16eac8..2bb52f376792 100644 --- a/taskcluster/gecko_taskgraph/decision.py +++ b/taskcluster/gecko_taskgraph/decision.py @@ -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 diff --git a/taskcluster/gecko_taskgraph/generator.py b/taskcluster/gecko_taskgraph/generator.py index 3ccb91ee2e4d..7b9eef756f15 100644 --- a/taskcluster/gecko_taskgraph/generator.py +++ b/taskcluster/gecko_taskgraph/generator.py @@ -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() diff --git a/taskcluster/gecko_taskgraph/parameters.py b/taskcluster/gecko_taskgraph/parameters.py index 83851901143f..1e687a33caa4 100644 --- a/taskcluster/gecko_taskgraph/parameters.py +++ b/taskcluster/gecko_taskgraph/parameters.py @@ -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": "", diff --git a/taskcluster/gecko_taskgraph/test/conftest.py b/taskcluster/gecko_taskgraph/test/conftest.py index 42bdc3b93da2..a751985685c4 100644 --- a/taskcluster/gecko_taskgraph/test/conftest.py +++ b/taskcluster/gecko_taskgraph/test/conftest.py @@ -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, diff --git a/taskcluster/gecko_taskgraph/test/test_generator.py b/taskcluster/gecko_taskgraph/test/test_generator.py index 35c62e2479c1..728034ad1c57 100644 --- a/taskcluster/gecko_taskgraph/test/test_generator.py +++ b/taskcluster/gecko_taskgraph/test/test_generator.py @@ -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( diff --git a/taskcluster/test/params/try.yml b/taskcluster/test/params/try.yml index 0ce277e86d70..7fddf517f377 100644 --- a/taskcluster/test/params/try.yml +++ b/taskcluster/test/params/try.yml @@ -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