Skip to content

Commit

Permalink
Bug 1618067 - rebuild-cached-tasks action r=taskgraph-reviewers,jmahe…
Browse files Browse the repository at this point in the history
…r DONTBUILD

Cached tasks help us reuse existing tasks for toolchain, docker-image,
and fetch tasks, among others. This saves us compute cycles and
end-to-end time; it also allows us to keep these artifacts pinned
until we rebuild, which is a way to keep non-deterministic
artifacts, like docker images, in a predictable state.

However, occasionally we need to rebuild these tasks, e.g. when we
rotate the CoT key and want to invalidate the old key that we signed
the existing cached_tasks with. Until now, this process was unwieldy.
Now we have an action to allow us to do this at will.

Differential Revision: https://phabricator.services.mozilla.com/D118749
  • Loading branch information
escapewindow committed Jun 25, 2021
1 parent 2d0f251 commit 9df3b70
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions taskcluster/taskgraph/actions/rebuild_cached_tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 __future__ import absolute_import, print_function, unicode_literals

from .registry import register_callback_action
from .util import (
create_tasks,
fetch_graph_and_labels,
)


@register_callback_action(
name="rebuild-cached-tasks",
title="Rebuild Cached Tasks",
symbol="rebuild-cached",
description="Rebuild cached tasks.",
order=1000,
context=[],
)
def rebuild_cached_tasks_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
)
cached_tasks = [
label
for label, task in full_task_graph.tasks.items()
if task.attributes.get("cached_task", False)
]
if cached_tasks:
create_tasks(
graph_config,
cached_tasks,
full_task_graph,
label_to_taskid,
parameters,
decision_task_id,
)

0 comments on commit 9df3b70

Please sign in to comment.