Bug 1887776 - Add generic action to trigger tb-rust automation with correct Gecko rev. r=dandarnell
Generic actions usually run with the same GECKO/COMM revisions as the Decision task they are called from. The Rust vendor automation needs to run with the latest tip of mozilla-central though. Create a new custom-push-action to run the automation. The modified function updates the environment of the task with the correct revision. Differential Revision: https://phabricator.services.mozilla.com/D205652 --HG-- extra : amend_source : 16fd9980338c47e7e4004a240ad22e8e79b871b6
This commit is contained in:
Родитель
efa37a4915
Коммит
793e55e7a7
|
@ -2,9 +2,16 @@
|
|||
# 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/.
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from gecko_taskgraph import GECKO
|
||||
from gecko_taskgraph.actions.registry import register_callback_action
|
||||
from gecko_taskgraph.actions.util import create_tasks, fetch_graph_and_labels
|
||||
from gecko_taskgraph.util.attributes import RELEASE_PROMOTION_PROJECTS
|
||||
from mozversioncontrol import HgRepository
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def is_release_promotion_available(parameters):
|
||||
|
@ -36,3 +43,41 @@ def l10n_bump_action(parameters, graph_config, _input, task_group_id, task_id):
|
|||
parameters,
|
||||
decision_task_id,
|
||||
)
|
||||
|
||||
|
||||
@register_callback_action(
|
||||
name="tb-rust-sync",
|
||||
title="Vendored Rust Sync",
|
||||
symbol="tb_rust_sync",
|
||||
description="Sync /comm/third_party/rust with mozilla-central",
|
||||
order=120,
|
||||
context=[],
|
||||
available=lambda p: p["project"] in ("comm-central", "try-comm-central"),
|
||||
)
|
||||
def tb_rust_sync_action(parameters, graph_config, _input, task_group_id, task_id):
|
||||
"""
|
||||
Trigger Rust vendored code sync with mozilla-central.
|
||||
"""
|
||||
decision_task_id, full_task_graph, label_to_taskid, _ = fetch_graph_and_labels(
|
||||
parameters, graph_config
|
||||
)
|
||||
remote = "https://hg.mozilla.org/mozilla-central"
|
||||
repo = HgRepository(Path(GECKO))
|
||||
rev = repo._run("id", "-i", "--template={node}", remote)
|
||||
logger.info(f"Setting upstream rev to {rev}")
|
||||
|
||||
def modifier(entry):
|
||||
if entry.kind == "repo-update":
|
||||
entry.task["payload"]["env"]["GECKO_HEAD_REV"] = rev
|
||||
return entry
|
||||
|
||||
to_run = ["repo-update-tb-rust-vendor"]
|
||||
create_tasks(
|
||||
graph_config,
|
||||
to_run,
|
||||
full_task_graph,
|
||||
label_to_taskid,
|
||||
parameters,
|
||||
decision_task_id,
|
||||
modifier=modifier,
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче