Skip to content

Commit

Permalink
Bug 1649168: Add scriptworker-canary action and corresponding task; r…
Browse files Browse the repository at this point in the history
…=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
tomprince committed Jul 10, 2020
1 parent 174ce0a commit 486188a
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build/sparse-profiles/push-to-try
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
33 changes: 33 additions & 0 deletions taskcluster/ci/scriptworker-canary/kind.yml
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
4 changes: 4 additions & 0 deletions taskcluster/docs/kinds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -700,3 +700,7 @@ Generate missing macOS and windows system symbols from crash reports.
system-symbols-upload
---------------------
Upload macOS and windows system symbols to tecken.

scriptworker-canary
-------------------
Push tasks to try to test new scriptworker deployments.
49 changes: 49 additions & 0 deletions taskcluster/taskgraph/actions/scriptworker_canary.py
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)
10 changes: 10 additions & 0 deletions taskcluster/taskgraph/target_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,16 @@ def filter(task):
return [l for l, t in six.iteritems(full_task_graph.tasks) if filter(t)]


@_target_task('scriptworker_canary')
def target_tasks_scriptworker_canary(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to run scriptworker canaries.
"""
def filter(task):
# For now any task in the repo-update kind is ok
return task.kind in ['scriptworker-canary']
return [l for l, t in six.iteritems(full_task_graph.tasks) if filter(t)]


@_target_task('cron_bouncer_check')
def target_tasks_bouncer_check(full_task_graph, parameters, graph_config):
"""Select the set of tasks required to perform bouncer version verification.
Expand Down
46 changes: 46 additions & 0 deletions taskcluster/taskgraph/transforms/scriptworker_canary.py
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
2 changes: 2 additions & 0 deletions tools/lint/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ black:
- python/mozperftest/mozperftest
- python/mozrelease/mozrelease/scriptworker_canary.py
- taskcluster/docker/funsize-update-generator
- taskcluster/taskgraph/actions/scriptworker_canary.py
- taskcluster/taskgraph/transforms/scriptworker_canary.py
- testing/condprofile/condprof
- tools/crashreporter/system-symbols
- tools/lint/
Expand Down

0 comments on commit 486188a

Please sign in to comment.