From 2269a994fe8ee00f92cc3d18bf26782e0f293008 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Thu, 17 Oct 2024 10:26:07 +0200 Subject: [PATCH] actions: look up action tasks by revision in fetch_graph_and_labels (#589) Projects on github don't have a meaningful pushlog-id, so we don't use it in the index path for action tasks. When building the label-to-taskid mapping for a revision, look up action tasks in the index using the head_rev, where we can actually find them. This can potentially do the wrong thing if a revision is pushed to two different branches, where we'd be mixing up the graphs, but we don't currently include the branch name in the index paths. --- src/taskgraph/actions/util.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/taskgraph/actions/util.py b/src/taskgraph/actions/util.py index 13c0c1278..253896314 100644 --- a/src/taskgraph/actions/util.py +++ b/src/taskgraph/actions/util.py @@ -64,12 +64,19 @@ def fetch_action(task_id): raise logger.debug(f"No label-to-taskid.json found for {task_id}: {e}") - namespace = "{}.v2.{}.pushlog-id.{}.actions".format( + # for backwards compatibility, look up actions via pushlog-id + pushlog_namespace = "{}.v2.{}.pushlog-id.{}.actions".format( graph_config["trust-domain"], parameters["project"], parameters["pushlog_id"], ) - for task_id in list_tasks(namespace): + # ... but also look by revision, since github doesn't have pushlog-id + rev_namespace = "{}.v2.{}.revision.{}.actions".format( + graph_config["trust-domain"], + parameters["project"], + parameters["head_rev"], + ) + for task_id in set(list_tasks(pushlog_namespace) + list_tasks(rev_namespace)): fetches.append(e.submit(fetch_action, task_id)) # Similarly for cron tasks..