Files
Julien Cristau dc1a0c89a1 Bug 1856897 - fix rerun actions in the presence of multiple tasks with the same label. r=taskgraph-reviewers,releng-reviewers,bhearsum
`fetch_graph_and_labels` grabs the `label_to_taskid` mapping from the original
decision task plus any action and cron tasks on the same revision.  In that
process it only keeps track of one task id per label (whichever it sees last).

In most cases that's not a big deal, but there's a couple of instances where it
matters:

- the `rerun` action checks that the input task id is part of the mapping, and
  doesn't do anything if it is not, so won't rerun a task that was part of the
  initial graph and whose label was re-used later (e.g. from a retrigger)
- the `retrigger-multiple` action checks to see if a label should be rerun
  instead, and in that case uses the label_to_taskid mapping to decide which
  exact task to rerun.  Again if there's more than one task on that revision
  with the same label (e.g. from a forced retrigger or cron), it might not pick
  the expected one.

Fix this by having `fetch_graph_and_labels` also return a `label_to_taskids`
mapping.  The `rerun` action's check now looks for the task id there instead of
the incomplete `label_to_taskid`, and `retrigger-multiple` attempts to rerun
all tasks with the given label instead of just one.

Differential Revision: https://phabricator.services.mozilla.com/D194600
2023-11-30 13:48:17 +00:00

34 lines
977 B
Python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from .registry import register_callback_action
from .util import create_tasks, fetch_graph_and_labels
@register_callback_action(
name="openh264",
title="OpenH264 Binaries",
symbol="h264",
description="Action to prepare openh264 binaries for shipping",
context=[],
)
def openh264_action(parameters, graph_config, input, task_group_id, task_id):
decision_task_id, full_task_graph, label_to_taskid, _ = fetch_graph_and_labels(
parameters, graph_config
)
to_run = [
label
for label, entry in full_task_graph.tasks.items()
if "openh264" in entry.kind
]
create_tasks(
graph_config,
to_run,
full_task_graph,
label_to_taskid,
parameters,
decision_task_id,
)