Bug 1491186 - Don't sanity check scopes for kind=task. r=bhearsum, a=release
authorDustin J. Mitchell <dustin@mozilla.com>
Tue, 25 Sep 2018 14:24:43 +0000
changeset 481194 5f9fa0298fc3
parent 481193 dc99e844c2af
child 481195 c9ed11ae5c79
push id1805
push userjcristau@mozilla.com
push date2018-10-01 15:12 +0000
treeherdermozilla-release@5f9fa0298fc3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhearsum, release
bugs1491186
milestone62.0.3
Bug 1491186 - Don't sanity check scopes for kind=task. r=bhearsum, a=release Differential Revision: https://phabricator.services.mozilla.com/D6774
taskcluster/taskgraph/actions/registry.py
--- a/taskcluster/taskgraph/actions/registry.py
+++ b/taskcluster/taskgraph/actions/registry.py
@@ -17,17 +17,17 @@ from taskgraph.config import load_graph_
 from taskgraph.util import taskcluster, yaml, hash
 from taskgraph.parameters import Parameters
 from mozbuild.util import memoize
 
 
 actions = []
 callbacks = {}
 
-Action = namedtuple('Action', ['order', 'cb_name', 'generic', 'action_builder'])
+Action = namedtuple('Action', ['order', 'kind', 'cb_name', 'generic', 'action_builder'])
 
 
 def is_json(data):
     """ Return ``True``, if ``data`` is a JSON serializable data structure. """
     try:
         json.dumps(data)
     except ValueError:
         return False
@@ -263,17 +263,17 @@ def register_callback_action(name, title
                             'taskId': {'$eval': 'taskId'},  # target taskId (or null)
                             'taskGroupId': {'$eval': 'taskGroupId'},  # target task group
                         }
                     },
                 })
 
             return rv
 
-        actions.append(Action(order, cb_name, generic, action_builder))
+        actions.append(Action(order, kind, cb_name, generic, action_builder))
 
         mem['registered'] = True
         callbacks[cb_name] = cb
     return register_callback
 
 
 def render_actions_json(parameters, graph_config):
     """
@@ -313,16 +313,19 @@ def sanity_check_task_scope(callback, pa
     prevent serious damage from such abuse, it's never a valid thing to do.
     """
     for action in _get_actions(graph_config):
         if action.cb_name == callback:
             break
     else:
         raise Exception('No action with cb_name {}'.format(callback))
 
+    if action.kind == 'task':
+        return  # task kinds don't have sane scopes, so bail out
+
     actionPerm = 'generic' if action.generic else action.cb_name
 
     repo_param = '{}head_repository'.format(graph_config['project-repo-param-prefix'])
     head_repository = parameters[repo_param]
     assert head_repository.startswith('https://hg.mozilla.org/')
     expected_scope = 'assume:repo:{}:action:{}'.format(head_repository[8:], actionPerm)
 
     # the scope should appear literally; no need for a satisfaction check. The use of