From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- taskcluster/gecko_taskgraph/morph.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'taskcluster/gecko_taskgraph/morph.py') diff --git a/taskcluster/gecko_taskgraph/morph.py b/taskcluster/gecko_taskgraph/morph.py index 1d03ddaab6..42fe4597fa 100644 --- a/taskcluster/gecko_taskgraph/morph.py +++ b/taskcluster/gecko_taskgraph/morph.py @@ -254,10 +254,31 @@ def add_eager_cache_index_tasks(taskgraph, label_to_taskid, parameters, graph_co @register_morph def add_try_task_duplicates(taskgraph, label_to_taskid, parameters, graph_config): - try_config = parameters["try_task_config"] + return _add_try_task_duplicates( + taskgraph, label_to_taskid, parameters, graph_config + ) + + +# this shim function exists so we can call it from the unittests. +# this works around an issue with +# third_party/python/taskcluster_taskgraph/taskgraph/morph.py#40 +def _add_try_task_duplicates(taskgraph, label_to_taskid, parameters, graph_config): + try_config = parameters.get("try_task_config", {}) + tasks = try_config.get("tasks", []) + glob_tasks = {x.strip("-*") for x in tasks if x.endswith("-*")} + tasks = set(tasks) - glob_tasks + rebuild = try_config.get("rebuild") if rebuild: for task in taskgraph.tasks.values(): - if task.label in try_config.get("tasks", []): + chunk_index = -1 + if task.label.endswith("-cf"): + chunk_index = -2 + label_parts = task.label.split("-") + label_no_chunk = "-".join(label_parts[:chunk_index]) + + if label_parts[chunk_index].isnumeric() and label_no_chunk in glob_tasks: + task.attributes["task_duplicates"] = rebuild + elif task.label in tasks: task.attributes["task_duplicates"] = rebuild return taskgraph, label_to_taskid -- cgit v1.2.3