scriptworker_canary.py (1497B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 from taskgraph.parameters import Parameters 6 7 from gecko_taskgraph.actions.registry import register_callback_action 8 from gecko_taskgraph.decision import taskgraph_decision 9 10 11 @register_callback_action( 12 title="Push scriptworker canaries.", 13 name="scriptworker-canary", 14 symbol="scriptworker-canary", 15 description="Trigger scriptworker-canary pushes for the given scriptworkers.", 16 schema={ 17 "type": "object", 18 "properties": { 19 "scriptworkers": { 20 "type": "array", 21 "description": "List of scriptworker types to run canaries for.", 22 "items": {"type": "string"}, 23 }, 24 }, 25 }, 26 order=1000, 27 permission="scriptworker-canary", 28 context=[], 29 ) 30 def scriptworker_canary(parameters, graph_config, input, task_group_id, task_id): 31 scriptworkers = input["scriptworkers"] 32 33 # make parameters read-write 34 parameters = dict(parameters) 35 36 parameters["target_tasks_method"] = "scriptworker_canary" 37 parameters["try_task_config"] = { 38 "scriptworker-canary-workers": scriptworkers, 39 } 40 parameters["tasks_for"] = "action" 41 42 # make parameters read-only 43 parameters = Parameters(**parameters) 44 45 taskgraph_decision({"root": graph_config.root_dir}, parameters=parameters)