Bug 1318438 - [taskcluster] Look for build_type under 'treeherder/platform' if not specified in name, r?dustin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 18 Nov 2016 15:09:08 -0500
changeset 441377 ff8920642caba19e7f09d85cad84309179388476
parent 441376 11fee6053eeaf39226d97583743b99f6464fe487
child 537540 d32abff7552f179cf45e97fa3026581bcc44dbf6
push id36408
push userahalberstadt@mozilla.com
push dateFri, 18 Nov 2016 20:15:41 +0000
reviewersdustin
bugs1318438
milestone53.0a1
Bug 1318438 - [taskcluster] Look for build_type under 'treeherder/platform' if not specified in name, r?dustin This patch also removes the superfluous build type in the names of all the source-check tasks. MozReview-Commit-ID: JwL1NAR4bnY
taskcluster/ci/source-check/doc.yml
taskcluster/ci/source-check/mozlint.yml
taskcluster/ci/source-check/python-tests.yml
taskcluster/taskgraph/transforms/build_attrs.py
--- a/taskcluster/ci/source-check/doc.yml
+++ b/taskcluster/ci/source-check/doc.yml
@@ -1,9 +1,9 @@
-sphinx/opt:
+sphinx:
     description: Generate the Sphinx documentation
     treeherder:
         symbol: tc(Doc)
         kind: test
         tier: 1
         platform: lint/opt
     worker-type: aws-provisioner-v1/b2gtest
     worker:
--- a/taskcluster/ci/source-check/mozlint.yml
+++ b/taskcluster/ci/source-check/mozlint.yml
@@ -1,9 +1,9 @@
-mozlint-eslint/opt:
+mozlint-eslint:
     description: JS lint check
     treeherder:
         symbol: ES
         kind: test
         tier: 1
         platform: lint/opt
     worker-type: aws-provisioner-v1/b2gtest
     worker:
@@ -37,17 +37,17 @@ mozlint-eslint/opt:
             - '**/*eslintrc*'
             # The plugin implementing custom checks.
             - 'tools/lint/eslint/eslint-plugin-mozilla/**'
             # Other misc lint related files.
             - 'python/mozlint/**'
             - 'tools/lint/**'
             - 'testing/docker/lint/**'
 
-mozlint-flake8/opt:
+mozlint-flake8:
     description: flake8 run over the gecko codebase
     treeherder:
         symbol: f8
         kind: test
         tier: 1
         platform: lint/opt
     worker-type: aws-provisioner-v1/b2gtest
     worker:
@@ -63,17 +63,17 @@ mozlint-flake8/opt:
     when:
         files-changed:
             - '**/*.py'
             - '**/.flake8'
             - 'python/mozlint/**'
             - 'tools/lint/**'
             - 'testing/docker/lint/**'
 
-wptlint-gecko/opt:
+wptlint-gecko:
     description: web-platform-tests linter
     treeherder:
         symbol: W
         kind: test
         tier: 1
         platform: lint/opt
     worker-type: aws-provisioner-v1/b2gtest
     worker:
--- a/taskcluster/ci/source-check/python-tests.yml
+++ b/taskcluster/ci/source-check/python-tests.yml
@@ -1,9 +1,9 @@
-taskgraph-tests/opt:
+taskgraph-tests:
     description: taskcluster/taskgraph unit tests
     treeherder:
         symbol: tg
         kind: test
         tier: 2
         platform: linux64/opt
     worker-type: aws-provisioner-v1/b2gtest
     worker:
@@ -17,17 +17,17 @@ taskgraph-tests/opt:
         - integration
         - release
     when:
         files-changed:
             - 'taskcluster/**/*.py'
             - 'config/mozunit.py'
             - 'python/mach/**/*.py'
 
-mozharness/opt:
+mozharness:
     description: mozharness integration tests
     treeherder:
         symbol: MH
         kind: test
         tier: 2
         platform: lint/opt
     worker-type: aws-provisioner-v1/b2gtest
     worker:
--- a/taskcluster/taskgraph/transforms/build_attrs.py
+++ b/taskcluster/taskgraph/transforms/build_attrs.py
@@ -12,17 +12,25 @@ transforms = TransformSequence()
 def set_build_attributes(config, jobs):
     """
     Set the build_platform and build_type attributes based on the job name.
     Although not all jobs using this transform are actual "builds", the try
     option syntax treats them as such, and this arranges the attributes
     appropriately for that purpose.
     """
     for job in jobs:
-        build_platform, build_type = job['name'].split('/')
+        try:
+            build_platform, build_type = job['name'].split('/')
+        except ValueError:
+            if 'treeherder' not in job or 'platform' not in job['treeherder']:
+                raise
+
+            # if build_type not in name, grab it from treeherder platform
+            build_platform = job['name']
+            build_type = job['treeherder']['platform'].split('/')[-1]
 
         # pgo builds are represented as a different platform, type opt
         if build_type == 'pgo':
             build_platform = build_platform + '-pgo'
             build_type = 'opt'
 
         attributes = job.setdefault('attributes', {})
         attributes.update({