Bug 1388478 - Load tests.yml tasks with the transform loader, r?dustin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 17 Oct 2017 15:57:14 -0400
changeset 682329 80d01e93b38f58608d8087598c1fa5f8f748532f
parent 682254 a29052590fc6538b89641e690d11731ca8e78120
child 682330 ae618ea14afd365fbe04687cd96e648508c8fd16
child 682336 814512dfce65de0fa7f207c488190e6dfabbf9e2
child 682846 dcc2ddfbc2c70f50790adef9801c1eef8734d990
push id85071
push userahalberstadt@mozilla.com
push dateWed, 18 Oct 2017 13:24:25 +0000
reviewersdustin
bugs1388478
milestone58.0a1
Bug 1388478 - Load tests.yml tasks with the transform loader, r?dustin This will allow us to use 'jobs', 'jobs-from' and 'job-defaults' with the test kind. MozReview-Commit-ID: 7q66kjSI4b3
taskcluster/ci/test/kind.yml
taskcluster/taskgraph/loader/test.py
taskcluster/taskgraph/transforms/tests.py
--- a/taskcluster/ci/test/kind.yml
+++ b/taskcluster/ci/test/kind.yml
@@ -4,8 +4,11 @@ kind-dependencies:
     - build
     - build-signing
 
 transforms:
    - taskgraph.transforms.tests:transforms
    - taskgraph.transforms.job:transforms
    - taskgraph.transforms.coalesce:transforms
    - taskgraph.transforms.task:transforms
+
+jobs-from:
+   - tests.yml
--- a/taskcluster/taskgraph/loader/test.py
+++ b/taskcluster/taskgraph/loader/test.py
@@ -2,16 +2,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import copy
 import logging
 
+from .transform import loader as transform_loader
 from ..util.yaml import load_yaml
 
 logger = logging.getLogger(__name__)
 
 
 def loader(kind, path, config, params, loaded_tasks):
     """
     Generate tasks implementing Gecko tests.
@@ -34,17 +35,18 @@ def loader(kind, path, config, params, l
         test_platforms_cfg, builds_by_platform, signed_builds_by_platform
     )
 
     # expand the test sets for each of those platforms
     test_sets_cfg = load_yaml(path, 'test-sets.yml')
     test_platforms = expand_tests(test_sets_cfg, test_platforms)
 
     # load the test descriptions
-    test_descriptions = load_yaml(path, 'tests.yml', enforce_order=True)
+    tests = transform_loader(kind, path, config, params, loaded_tasks)
+    test_descriptions = {t.pop('name'): t for t in tests}
 
     # generate all tests for all test platforms
     for test_platform_name, test_platform in test_platforms.iteritems():
         for test_name in test_platform['test-names']:
             test = copy.deepcopy(test_descriptions[test_name])
             test['build-platform'] = test_platform['build-platform']
             test['test-platform'] = test_platform_name
             test['build-label'] = test_platform['build-label']
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -163,16 +163,19 @@ test_description_schema = Schema({
     # 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,
 
     # attributes to appear in the resulting task (later transforms will add the
     # common attributes)
     Optional('attributes'): {basestring: object},
 
+    # relative path (from config.path) to the file task was defined in
+    Optional('job-from'): basestring,
+
     # The `run_on_projects` attribute, defaulting to "all".  This dictates the
     # projects on which this task should be included in the target task set.
     # See the attributes documentation for details.
     #
     # Note that the special case 'built-projects', the default, uses the parent
     # build task's run-on-projects, meaning that tests run only on platforms
     # that are built.
     Optional('run-on-projects', default='built-projects'): optionally_keyed_by(