Bug 1415868 - remove ACTION_TASK r=jonasfj,tomprince
authorDustin J. Mitchell <dustin@mozilla.com>
Fri, 27 Apr 2018 22:24:42 +0000
changeset 475918 e2931d9049750c5a9da8caca77d4da65d085ef7b
parent 475917 4cbd35f872893c1426a7845f990d860a32c08710
child 475919 d4643b526038fa61a2f634d38775e849dba00689
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonasfj, tomprince
bugs1415868
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
.taskcluster.yml
taskcluster/mach_commands.py
taskcluster/taskgraph/actions/registry.py
--- a/.taskcluster.yml
+++ b/.taskcluster.yml
@@ -103,17 +103,16 @@ tasks:
               GECKO_HEAD_REV: '${push.revision}'
               GECKO_COMMIT_MSG: {$if: 'tasks_for != "action"', then: '${push.comment}'}
               HG_STORE_PATH: /builds/worker/checkouts/hg-store
               TASKCLUSTER_CACHES: /builds/worker/checkouts
             - $if: 'tasks_for == "action"'
               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'}}
 
         cache:
           level-${repository.level}-checkouts-sparse-v2: /builds/worker/checkouts
 
         features:
--- a/taskcluster/mach_commands.py
+++ b/taskcluster/mach_commands.py
@@ -230,26 +230,24 @@ class MachCommands(MachCommandBase):
                      help="root of the taskgraph definition relative to topsrcdir")
     def action_callback(self, **options):
         import taskgraph.actions
         try:
             self.setup_logging()
 
             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', '{}'))
             root = options['root']
 
             return taskgraph.actions.trigger_action_callback(
                     task_group_id=task_group_id,
                     task_id=task_id,
-                    task=task,
                     input=input,
                     callback=callback,
                     parameters=parameters,
                     root=root,
                     test=False)
         except Exception:
             traceback.print_exc()
             sys.exit(1)
--- a/taskcluster/taskgraph/actions/registry.py
+++ b/taskcluster/taskgraph/actions/registry.py
@@ -213,17 +213,16 @@ def register_callback_action(name, title
                             'push': push,
                             # parameters is long, so fetch it from the actions.json variables
                             'parameters': {'$eval': 'parameters'},
                         },
 
                         # and pass everything else through from our own context
                         "user": {
                             'input': {'$eval': 'input'},
-                            'task': {'$eval': 'task'},
                             'taskId': {'$eval': 'taskId'},
                             'taskGroupId': {'$eval': 'taskGroupId'},
                         }
                     },
                 })
 
             return rv
 
@@ -259,33 +258,39 @@ def render_actions_json(parameters, grap
         'version': 1,
         'variables': {
             'parameters': dict(**parameters),
         },
         'actions': actions,
     }
 
 
-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
     the action callback in testing mode, without actually creating tasks.
     """
     graph_config = load_graph_config(root)
     callbacks = _get_callbacks(graph_config)
     cb = callbacks.get(callback, None)
     if not cb:
         raise Exception('Unknown callback: {}. Known callbacks: {}'.format(
             callback, callbacks))
 
     if test:
         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)
 
 
 def _load(graph_config):
     # Load all modules from this folder, relying on the side-effects of register_
     # functions to populate the action registry.
     actions_dir = os.path.dirname(__file__)
     for f in os.listdir(actions_dir):