commit 22aa0b8ee0758bf8a05d3057c873152201c694c8
parent 5129ce03b505c5e414701fc662350efa79670d9a
Author: Andrew Halberstadt <ahal@mozilla.com>
Date: Fri, 19 Dec 2025 19:11:08 +0000
Bug 2007123 - Support 'run-on-git-branches' in Gecko Taskgraph, r=taskgraph-reviewers,jcristau
Differential Revision: https://phabricator.services.mozilla.com/D277187
Diffstat:
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/taskcluster/gecko_taskgraph/transforms/job/__init__.py b/taskcluster/gecko_taskgraph/transforms/job/__init__.py
@@ -58,6 +58,7 @@ job_description_schema = Schema(
Optional("index"): task_description_schema["index"],
Optional("run-on-repo-type"): task_description_schema["run-on-repo-type"],
Optional("run-on-projects"): task_description_schema["run-on-projects"],
+ Optional("run-on-git-branches"): task_description_schema["run-on-git-branches"],
Optional("shipping-phase"): task_description_schema["shipping-phase"],
Optional("shipping-product"): task_description_schema["shipping-product"],
Optional("always-target"): task_description_schema["always-target"],
diff --git a/taskcluster/gecko_taskgraph/transforms/task.py b/taskcluster/gecko_taskgraph/transforms/task.py
@@ -180,6 +180,8 @@ task_description_schema = Schema(
Optional("run-on-projects"): optionally_keyed_by("build-platform", [str]),
# Like `run_on_projects`, `run-on-hg-branches` defaults to "all".
Optional("run-on-hg-branches"): optionally_keyed_by("project", [str]),
+ # Specifies git branches for which this task should run.
+ Optional("run-on-git-branches"): [str],
# The `shipping_phase` attribute, defaulting to None. This specifies the
# release promotion phase that this task belongs to.
Required("shipping-phase"): Any(
@@ -2357,6 +2359,12 @@ def build_task(config, tasks):
)
attributes["run_on_repo_type"] = task.get("run-on-repo-type", ["git", "hg"])
attributes["run_on_projects"] = task.get("run-on-projects", ["all"])
+
+ # We don't want to pollute non git repos with this attribute. Moreover, target_tasks
+ # already assumes the default value is ['all']
+ if task.get("run-on-git-branches"):
+ attributes["run_on_git_branches"] = task["run-on-git-branches"]
+
attributes["always_target"] = task["always-target"]
# This logic is here since downstream tasks don't always match their
# upstream dependency's shipping_phase.
diff --git a/taskcluster/gecko_taskgraph/transforms/test/__init__.py b/taskcluster/gecko_taskgraph/transforms/test/__init__.py
@@ -93,6 +93,8 @@ test_description_schema = Schema(
),
# Whether tasks should run on only a specific type of repository.
Optional("run-on-repo-type"): job_description_schema["run-on-repo-type"],
+ # Whether tasks should run on specified Git branches.
+ Optional("run-on-git-branches"): job_description_schema["run-on-git-branches"],
# When set only run on projects where the build would already be running.
# This ensures tasks where this is True won't be the cause of the build
# running on a project it otherwise wouldn't have.