Bug 1322433 - Make it possible to add tags + add a mochitest tag to mochitest jobs r?jonasfj draft
authorWilliam Lachance <wlachance@mozilla.com>
Wed, 25 Jan 2017 16:04:37 -0500
changeset 488877 3fe78bba022b8dacd986503af74b4698f90c25b2
parent 488074 b06968288cff469814bf830aa90f1c84da490f61
child 546858 57d48d6cfc7110d9cd07b1f4283cee9935f641b6
push id46666
push userwlachance@mozilla.com
push dateThu, 23 Feb 2017 22:24:23 +0000
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
@@ -351,16 +351,18 @@ marionette:
                         default:
                             - marionette/prod_config.py
                             - remove_executables.py
 
 mochitest:
     description: "Mochitest plain run"
     suite: mochitest/plain-chunked
     treeherder-symbol: tc-M()
+    tags:
+        test-type: mochitest
     loopback-video: true
     instance-size:
         by-test-platform:
             android.*: xlarge
             default: legacy # Bug 1281241: migrating to m3.large instances
     chunks:
         by-test-platform:
             android-4.3-arm7-api-15/debug: 32
--- 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,