Bug 1371497 - More robust handling of spaces in variant processing for Talos BBB; r?froydnj draft
authorGregory Szorc <gps@mozilla.com>
Fri, 09 Jun 2017 10:55:19 -0700
changeset 591949 af318bfbc771a86fcc43e84d8e794ef3650d731a
parent 591406 f4262773c4331d4ae139be536ce278ea9aad3436
child 632662 6f5906aea324f92bd06b23e76cf4cdab33cff718
push id63215
push usergszorc@mozilla.com
push dateFri, 09 Jun 2017 17:55:30 +0000
reviewersfroydnj
bugs1371497
milestone55.0a1
Bug 1371497 - More robust handling of spaces in variant processing for Talos BBB; r?froydnj We've changed this code twice recently and each time we accidentally disabled Talos builds because of subtle gotchas with regards to value checking and spaces in values. In this commit, we rewrite the code so spaces don't come into play during formatting. MozReview-Commit-ID: 7UX2X8LZDSF
taskcluster/taskgraph/transforms/job/mozharness_test.py
--- a/taskcluster/taskgraph/transforms/job/mozharness_test.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness_test.py
@@ -434,38 +434,38 @@ def mozharness_test_buildbot_bridge(conf
 
     if mozharness.get('chunked', False):
         this_chunk = test.get('this-chunk')
         test_name = '{}-{}'.format(test_name, this_chunk)
 
     if test.get('suite', '') == 'talos':
         # on linux64-<variant>/<build>, we add the variant to the buildername
         m = re.match(r'\w+-([^/]+)/.*', test['test-platform'])
-        variant = ''
-        if m and m.group(1):
-            variant = m.group(1) + ' '
+        variant = m.group(1) if m and m.group(1) else ''
+
         # On beta and release, we run nightly builds on-push; the talos
         # builders need to run against non-nightly buildernames
-        if variant == 'nightly ':
+        if variant == 'nightly':
             variant = ''
+
         # this variant name has branch after the variant type in BBB bug 1338871
         if variant in ('stylo', 'stylo-sequential'):
-            buildername = '{} {}{} talos {}'.format(
-                BUILDER_NAME_PREFIX[platform],
-                variant,
-                branch,
-                test_name
-            )
+            name = '{prefix} {variant} {branch} talos {test_name}'
+        elif variant:
+            name = '{prefix} {branch} {variant} talos {test_name}'
         else:
-            buildername = '{} {} {}talos {}'.format(
-                BUILDER_NAME_PREFIX[platform],
-                branch,
-                variant,
-                test_name
-            )
+            name = '{prefix} {branch} talos {test_name}'
+
+        buildername = name.format(
+            prefix=BUILDER_NAME_PREFIX[platform],
+            variant=variant,
+            branch=branch,
+            test_name=test_name
+        )
+
         if buildername.startswith('Ubuntu'):
             buildername = buildername.replace('VM', 'HW')
     else:
         buildername = '{} {} {} test {}'.format(
             BUILDER_NAME_PREFIX[platform],
             branch,
             build_type,
             test_name