Bug 1491186: don't sanity check scopes for kind=task r=bhearsum
authorDustin J. Mitchell <dustin@mozilla.com>
Tue, 25 Sep 2018 14:24:43 +0000
changeset 496755 9a765e968a4a8f290b30b41fd367514a36e4f022
parent 496754 3ecd0d2e00066a452e905d339c7cb598e14a21ad
child 496756 753cec0ea42c454a27c17381ef22a542b9f747d6
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhearsum
bugs1491186
milestone64.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 1491186: don't sanity check scopes for kind=task r=bhearsum 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