forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1649168: Add scriptworker-canary action and corresponding task; r…
…=rail Add an action that will trigger a task that runs `mach release push-scriptworker-canary` to test a new scriptworker deployment. Differential Revision: https://phabricator.services.mozilla.com/D82821
- Loading branch information
Showing
7 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
%include build/sparse-profiles/taskgraph | ||
|
||
[include] | ||
path:tools/tryselect/ | ||
path:try_task_config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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/. | ||
--- | ||
loader: taskgraph.loader.transform:loader | ||
|
||
transforms: | ||
- taskgraph.transforms.scriptworker_canary:transforms | ||
- taskgraph.transforms.job:transforms | ||
- taskgraph.transforms.task:transforms | ||
|
||
job-defaults: | ||
treeherder: | ||
platform: firefox-release/opt | ||
tier: 1 | ||
kind: build | ||
worker-type: b-linux | ||
worker: | ||
docker-image: {in-tree: push-to-try} | ||
max-run-time: 1800 | ||
env: | ||
MOZBUILD_STATE_PATH: /builds/worker/workspace | ||
run: | ||
sparse-profile: push-to-try | ||
|
||
jobs: | ||
push: | ||
description: Push scriptworker canary tasks. | ||
treeherder: | ||
symbol: Rel(push-scriptworker-canary) | ||
run-on-projects: [mozilla-central] | ||
addresses: ['release+scriptworker-canary@mozilla.com'] | ||
ssh-key-secret: project/releng/scriptworker/scriptworker-canary-sshkey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# 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 taskgraph.decision import taskgraph_decision | ||
from taskgraph.parameters import Parameters | ||
|
||
from .registry import register_callback_action | ||
|
||
|
||
@register_callback_action( | ||
title="", | ||
name="scriptworker-canary", | ||
symbol="scriptworker-canary", | ||
description="Trigger scriptworker-canary pushes for the given scriptworkers.", | ||
schema={ | ||
"type": "object", | ||
"properties": { | ||
"scriptworkers": { | ||
"type": "array", | ||
"description": "List of scriptworker types to run canaries for.", | ||
"items": {"type": "string"}, | ||
}, | ||
}, | ||
}, | ||
order=1000, | ||
permission="scriptworker-canary", | ||
context=[], | ||
) | ||
def scriptworker_canary(parameters, graph_config, input, task_group_id, task_id): | ||
scriptworkers = input["scriptworkers"] | ||
|
||
# make parameters read-write | ||
parameters = dict(parameters) | ||
|
||
parameters["target_tasks_method"] = "scriptworker_canary" | ||
parameters["try_task_config"] = { | ||
"scriptworker-canary-workers": scriptworkers, | ||
} | ||
parameters["tasks_for"] = "action" | ||
|
||
# make parameters read-only | ||
parameters = Parameters(**parameters) | ||
|
||
taskgraph_decision({"root": graph_config.root_dir}, parameters=parameters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 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/. | ||
""" | ||
Build a command to run `mach release push-scriptworker-canaries`. | ||
""" | ||
|
||
from __future__ import absolute_import, print_function, unicode_literals | ||
|
||
from pipes import quote as shell_quote | ||
|
||
from mozrelease.scriptworker_canary import TASK_TYPES | ||
|
||
from taskgraph.transforms.base import TransformSequence | ||
|
||
transforms = TransformSequence() | ||
|
||
|
||
@transforms.add | ||
def build_command(config, jobs): | ||
scriptworkers = config.params["try_task_config"].get("scriptworker-canary-workers") | ||
# Filter the list of workers to those we have configured a set of canary | ||
# tasks for. | ||
scriptworkers = [ | ||
scriptworker for scriptworker in scriptworkers if scriptworker in TASK_TYPES | ||
] | ||
|
||
if not scriptworkers: | ||
return | ||
|
||
for job in jobs: | ||
|
||
command = ["release", "push-scriptworker-canary"] | ||
for scriptworker in scriptworkers: | ||
command.extend(["--scriptworker", scriptworker]) | ||
for address in job.pop("addresses"): | ||
command.extend(["--address", address]) | ||
if "ssh-key-secret" in job: | ||
ssh_key_secret = job.pop("ssh-key-secret") | ||
command.extend(["--ssh-key-secret", ssh_key_secret]) | ||
job.setdefault("scopes", []).append("secrets:get:{}".format(ssh_key_secret)) | ||
|
||
job.setdefault("run", {}).update( | ||
{"using": "mach", "mach": " ".join(map(shell_quote, command))} | ||
) | ||
yield job |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters