Bug 1391323 - Make action tasks have task group and scheduler set by default r=dustin
authorBrian Stack <bstack@mozilla.com>
Thu, 17 Aug 2017 11:53:55 -0700
changeset 649605 f85e932a215795e0af458b646435df14f738ceb1
parent 649604 f48a6466aa910e2554eb81b8facabdd919e7d1a9
child 649606 16562a4d142441f6a4a7243bd3e14eeb6e2c1383
push id75073
push userbmo:mozilla@hocat.ca
push dateSun, 20 Aug 2017 22:21:51 +0000
reviewersdustin
bugs1391323
milestone57.0a1
Bug 1391323 - Make action tasks have task group and scheduler set by default r=dustin MozReview-Commit-ID: G7oPskaFBVO
taskcluster/taskgraph/actions/registry.py
--- a/taskcluster/taskgraph/actions/registry.py
+++ b/taskcluster/taskgraph/actions/registry.py
@@ -5,16 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import json
 import os
 import inspect
 import re
+from slugid import nice as slugid
 from mozbuild.util import memoize
 from types import FunctionType
 from collections import namedtuple
 from taskgraph import create
 from taskgraph.util.docker import docker_image
 from taskgraph.parameters import Parameters
 
 
@@ -178,30 +179,34 @@ def register_callback_action(name, title
                 return None
 
             match = re.match(r'https://(hg.mozilla.org)/(.*?)/?$', parameters['head_repository'])
             if not match:
                 raise Exception('Unrecognized head_repository')
             repo_scope = 'assume:repo:{}/{}:*'.format(
                 match.group(1), match.group(2))
 
+            task_group_id = os.environ.get('TASK_ID', slugid())
+
             return {
                 'created': {'$fromNow': ''},
                 'deadline': {'$fromNow': '12 hours'},
                 'expires': {'$fromNow': '14 days'},
                 'metadata': {
                     'owner': 'mozilla-taskcluster-maintenance@mozilla.com',
                     'source': '{}raw-file/{}/{}'.format(
                         parameters['head_repository'], parameters['head_rev'], source_path,
                     ),
                     'name': 'Action: {}'.format(title),
                     'description': 'Task executing callback for action.\n\n---\n' + description,
                 },
                 'workerType': 'gecko-{}-decision'.format(parameters['level']),
                 'provisionerId': 'aws-provisioner-v1',
+                'taskGroupId': task_group_id,
+                'schedulerId': 'gecko-level-{}'.format(parameters['level']),
                 'scopes': [
                     repo_scope,
                 ],
                 'tags': {
                     'createdForUser': parameters['owner'],
                     'kind': 'action-callback',
                 },
                 'routes': [
@@ -212,17 +217,17 @@ def register_callback_action(name, title
                 ],
                 'payload': {
                     'env': {
                         'GECKO_BASE_REPOSITORY': 'https://hg.mozilla.org/mozilla-unified',
                         'GECKO_HEAD_REPOSITORY': parameters['head_repository'],
                         'GECKO_HEAD_REF': parameters['head_ref'],
                         'GECKO_HEAD_REV': parameters['head_rev'],
                         'HG_STORE_PATH': '/home/worker/checkouts/hg-store',
-                        'ACTION_TASK_GROUP_ID': {'$eval': 'taskGroupId'},
+                        'ACTION_TASK_GROUP_ID': task_group_id,
                         'ACTION_TASK_ID': {'$json': {'$eval': 'taskId'}},
                         'ACTION_TASK': {'$json': {'$eval': 'task'}},
                         'ACTION_INPUT': {'$json': {'$eval': 'input'}},
                         'ACTION_CALLBACK': cb.__name__,
                         'ACTION_PARAMETERS': {'$json': {'$eval': 'parameters'}},
                     },
                     'cache': {
                         'level-{}-checkouts'.format(parameters['level']):