summaryrefslogtreecommitdiffstats
path: root/taskcluster/taskgraph/actions/scriptworker_canary.py
blob: 6af2c0ffc740b36ed3d7ec8d19a8293e7cc3c65e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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="Push scriptworker canaries.",
    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)