Bug 1322433 - Make it possible to add tags + add a mochitest tag to mochitest jobs r=jonasfj
authorWilliam Lachance <wlachance@mozilla.com>
Wed, 25 Jan 2017 16:04:37 -0500
changeset 373577 9a85f428c314cbbe0bae36f8fd1402373bdc7f71
parent 373576 0a0ad749ef253283e2288b5bcac8ea7a06b16eed
child 373578 798f55990ad17da87c774d62dfa91e2bced3ab81
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonasfj
bugs1322433
milestone54.0a1
Bug 1322433 - Make it possible to add tags + add a mochitest tag to mochitest jobs r=jonasfj This will be used to restrict mochitest actions to mochitest jobs only. MozReview-Commit-ID: DbFb9V6s9Rb
taskcluster/ci/test/tests.yml
taskcluster/taskgraph/transforms/job/__init__.py
taskcluster/taskgraph/transforms/task.py
taskcluster/taskgraph/transforms/tests.py
--- a/taskcluster/ci/test/tests.yml
+++ b/taskcluster/ci/test/tests.yml
@@ -354,16 +354,18 @@ marionette:
 
 mochitest:
     description: "Mochitest plain run"
     suite:
         by-test-platform:
             linux64-jsdcov/opt: mochitest/plain-chunked-coverage
             default: mochitest/plain-chunked
     treeherder-symbol: tc-M()
+    tags:
+        test-type: mochitest
     loopback-video: true
     instance-size:
         by-test-platform:
             linux64-jsdcov/opt: xlarge
             android.*: xlarge
             default: legacy # Bug 1281241: migrating to m3.large instances
     chunks:
         by-test-platform:
--- a/taskcluster/taskgraph/transforms/job/__init__.py
+++ b/taskcluster/taskgraph/transforms/job/__init__.py
@@ -47,16 +47,17 @@ job_description_schema = Schema({
     # possibly modified by the run implementation.  See
     # taskcluster/taskgraph/transforms/task.py for the schema details.
     Required('description'): task_description_schema['description'],
     Optional('attributes'): task_description_schema['attributes'],
     Optional('dependencies'): task_description_schema['dependencies'],
     Optional('expires-after'): task_description_schema['expires-after'],
     Optional('routes'): task_description_schema['routes'],
     Optional('scopes'): task_description_schema['scopes'],
+    Optional('tags'): task_description_schema['tags'],
     Optional('extra'): task_description_schema['extra'],
     Optional('treeherder'): task_description_schema['treeherder'],
     Optional('index'): task_description_schema['index'],
     Optional('run-on-projects'): task_description_schema['run-on-projects'],
     Optional('coalesce-name'): task_description_schema['coalesce-name'],
     Optional('needs-sccache'): task_description_schema['needs-sccache'],
     Optional('when'): task_description_schema['when'],
 
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -54,16 +54,19 @@ task_description_schema = Schema({
     # The index paths where this task may be cached. Transforms are expected to
     # fill these automatically when wanted.
     Optional('index-paths'): [basestring],
 
     # custom scopes for this task; any scopes required for the worker will be
     # added automatically
     Optional('scopes'): [basestring],
 
+    # Tags
+    Optional('tags'): {basestring: object},
+
     # custom "task.extra" content
     Optional('extra'): {basestring: object},
 
     # treeherder-related information; see
     # https://schemas.taskcluster.net/taskcluster-treeherder/v1/task-treeherder-config.json
     # If not specified, no treeherder extra information or routes will be
     # added to the task
     Optional('treeherder'): {
@@ -816,16 +819,19 @@ def build_task(config, tasks):
             task['deadline-after'] = '1 day'
 
         if 'coalesce-name' in task and int(config.params['level']) > 1:
             key = COALESCE_KEY.format(
                 project=config.params['project'],
                 name=task['coalesce-name'])
             routes.append('coalesce.v1.' + key)
 
+        tags = task.get('tags', {})
+        tags.update({'createdForUser': config.params['owner']})
+
         task_def = {
             'provisionerId': provisioner_id,
             'workerType': worker_type,
             'routes': routes,
             'created': {'relative-datestamp': '0 seconds'},
             'deadline': {'relative-datestamp': task['deadline-after']},
             'expires': {'relative-datestamp': task['expires-after']},
             'scopes': scopes,
@@ -834,17 +840,17 @@ def build_task(config, tasks):
                 'name': task['label'],
                 'owner': config.params['owner'],
                 'source': '{}/file/{}/{}'.format(
                     config.params['head_repository'],
                     config.params['head_rev'],
                     config.path),
             },
             'extra': extra,
-            'tags': {'createdForUser': config.params['owner']},
+            'tags': tags,
         }
 
         if task_th:
             # link back to treeherder in description
             th_push_link = 'https://treeherder.mozilla.org/#/jobs?repo={}&revision={}'.format(
                 config.params['project'], config.params['head_rev'])
             task_def['metadata']['description'] += ' ([Treeherder push]({}))'.format(
                 th_push_link)
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -73,16 +73,19 @@ test_description_schema = Schema({
 
     # the name by which this test suite is addressed in try syntax; defaults to
     # the test-name
     Optional('unittest-try-name'): basestring,
 
     # the name by which this talos test is addressed in try syntax
     Optional('talos-try-name'): basestring,
 
+    # additional tags to mark up this type of test
+    Optional('tags'): {basestring: object},
+
     # the symbol, or group(symbol), under which this task should appear in
     # treeherder.
     'treeherder-symbol': basestring,
 
     # the value to place in task.extra.treeherder.machine.platform; ideally
     # this is the same as build-platform, and that is the default, but in
     # practice it's not always a match.
     Optional('treeherder-machine-platform'): basestring,
@@ -634,16 +637,17 @@ def make_job_description(config, tests):
         jobdesc['label'] = label
         jobdesc['description'] = test['description']
         jobdesc['attributes'] = attributes
         jobdesc['dependencies'] = {'build': build_label}
         jobdesc['expires-after'] = test['expires-after']
         jobdesc['routes'] = []
         jobdesc['run-on-projects'] = test.get('run-on-projects', ['all'])
         jobdesc['scopes'] = []
+        jobdesc['tags'] = test.get('tags', {})
         jobdesc['extra'] = {
             'chunks': {
                 'current': test['this-chunk'],
                 'total': test['chunks'],
             },
             'suite': {
                 'name': suite,
                 'flavor': flavor,