Bug 1368733 - [taskcluster] Ensure job tasks run automatically on try when they're supposed to, r?dustin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 30 May 2017 12:37:03 -0400
changeset 586527 0314cf93c0003c72e95cdc04c612239387d2ecf7
parent 586442 286f71223256cbb3a769432fd860f563c4886e81
child 631024 6ab57732812ea207c3f97efab649fde80c8931d4
push id61445
push userahalberstadt@mozilla.com
push dateTue, 30 May 2017 17:20:40 +0000
reviewersdustin
bugs1368733
milestone55.0a1
Bug 1368733 - [taskcluster] Ensure job tasks run automatically on try when they're supposed to, r?dustin The logic here is a bit tricky to grok, but essentially there are two kinds of "job" tasks, those that should always be considered (and possibly be optimized away later due to "skip-unless-changed"), and those that should only be considered if their associated build-platform is also going to be scheduled. If -j is specified, that should supercede both cases. This patch uses the prescence of the 'build_platform' attribute to draw the distinction. MozReview-Commit-ID: H9SjeYuZ8F0
taskcluster/taskgraph/transforms/source_test.py
taskcluster/taskgraph/try_option_syntax.py
--- a/taskcluster/taskgraph/transforms/source_test.py
+++ b/taskcluster/taskgraph/transforms/source_test.py
@@ -98,17 +98,10 @@ def handle_platform(config, jobs):
         platform = job['platform']
 
         for field in fields:
             resolve_keyed_by(job, field, item_name=job['name'])
 
         if 'treeherder' in job:
             job['treeherder']['platform'] = platform
 
-        build_platform, build_type = platform.split('/')
-
-        job['attributes'].update({
-            'build_platform': build_platform,
-            'build_type': build_type,
-        })
-
         del job['platform']
         yield job
--- a/taskcluster/taskgraph/try_option_syntax.py
+++ b/taskcluster/taskgraph/try_option_syntax.py
@@ -581,19 +581,26 @@ class TryOptionSyntax(object):
                 if platform not in test['platforms']:
                     return False
             if 'only_chunks' in test and attr('test_chunk') not in test['only_chunks']:
                 return False
             return True
 
         job_try_name = attr('job_try_name')
         if job_try_name:
-            if self.jobs is None or job_try_name in self.jobs:
+            # Beware the subtle distinction between [] and None for self.jobs and self.platforms.
+            # They will be [] if there was no try syntax, and None if try syntax was detected but
+            # they remained unspecified.
+            if self.jobs and job_try_name not in self.jobs:
+                return False
+            elif not self.jobs and attr('build_platform'):
                 if self.platforms is None or attr('build_platform') in self.platforms:
                     return True
+                return False
+            return True
         elif attr('kind') == 'test':
             return match_test(self.unittests, 'unittest_try_name') \
                  or match_test(self.talos, 'talos_try_name')
         elif attr('kind') in BUILD_KINDS:
             if attr('build_type') not in self.build_types:
                 return False
             elif self.platforms is None:
                 # for "-p all", look for try in the 'run_on_projects' attribute