Bug 1415868 - remove ACTION_TASK r=jonasfj,tomprince

For kind=hook, the spec doesn't include this value as it's untrustworthy.

For kind=task, it's still untrustworthy, but there is no privilege escalation
so that's not important. Still, it dramatically expands the size of the task
definition.

MozReview-Commit-ID: 6scQ2ZwxP10

--HG--
extra : rebase_source : 4dc34390a510091ddc26023755992995fe358e47
This commit is contained in:
Dustin J. Mitchell 2018-04-27 22:24:42 +00:00
parent edbae96f0c
commit aeb0a55c25
3 changed files with 7 additions and 5 deletions

View File

@ -108,7 +108,6 @@ tasks:
then:
ACTION_TASK_GROUP_ID: '${ownTaskId}'
ACTION_TASK_ID: {$json: {$eval: 'taskId'}}
ACTION_TASK: {$json: {$eval: 'task'}}
ACTION_INPUT: {$json: {$eval: 'input'}}
ACTION_CALLBACK: '${action.cb_name}'
ACTION_PARAMETERS: {$json: {$eval: 'parameters'}}

View File

@ -235,7 +235,6 @@ class MachCommands(MachCommandBase):
task_group_id = os.environ.get('ACTION_TASK_GROUP_ID', None)
task_id = json.loads(os.environ.get('ACTION_TASK_ID', 'null'))
task = json.loads(os.environ.get('ACTION_TASK', 'null'))
input = json.loads(os.environ.get('ACTION_INPUT', 'null'))
callback = os.environ.get('ACTION_CALLBACK', None)
parameters = json.loads(os.environ.get('ACTION_PARAMETERS', '{}'))
@ -244,7 +243,6 @@ class MachCommands(MachCommandBase):
return taskgraph.actions.trigger_action_callback(
task_group_id=task_group_id,
task_id=task_id,
task=task,
input=input,
callback=callback,
parameters=parameters,

View File

@ -218,7 +218,6 @@ def register_callback_action(name, title, symbol, description, order=10000,
# and pass everything else through from our own context
"user": {
'input': {'$eval': 'input'},
'task': {'$eval': 'task'},
'taskId': {'$eval': 'taskId'},
'taskGroupId': {'$eval': 'taskGroupId'},
}
@ -264,7 +263,7 @@ def render_actions_json(parameters, graph_config):
}
def trigger_action_callback(task_group_id, task_id, task, input, callback, parameters, root,
def trigger_action_callback(task_group_id, task_id, input, callback, parameters, root,
test=False):
"""
Trigger action callback with the given inputs. If `test` is true, then run
@ -281,6 +280,12 @@ def trigger_action_callback(task_group_id, task_id, task, input, callback, param
create.testing = True
taskcluster.testing = True
# fetch the task, if taskId was given
# FIXME: many actions don't need this, so move this fetch into the callbacks
# that do need it
if task_id:
task = taskcluster.get_task_definition(task_id)
cb(Parameters(**parameters), graph_config, input, task_group_id, task_id, task)