bug 1442793 - tests artifact_prefix. r?bhearsum draft
authorAki Sasaki <asasaki@mozilla.com>
Wed, 07 Mar 2018 13:05:10 -0800
changeset 782022 0a8a69115ec02a8a62f29bf191044a27b71e3192
parent 782021 e963676946e1962f42ba0a471c2be7fa6d5ee2c9
child 782023 dd326fd78fed15a44863dd3483dd7600bfab1102
push id106465
push userasasaki@mozilla.com
push dateSat, 14 Apr 2018 00:42:17 +0000
reviewersbhearsum
bugs1442793
milestone61.0a1
bug 1442793 - tests artifact_prefix. r?bhearsum MozReview-Commit-ID: 1KFGftPjG9Z
taskcluster/taskgraph/transforms/tests.py
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -23,16 +23,17 @@ from taskgraph.transforms.base import Tr
 from taskgraph.util.schema import resolve_keyed_by, OptimizationSchema
 from taskgraph.util.treeherder import split_symbol, join_symbol
 from taskgraph.util.platforms import platform_family
 from taskgraph.util.schema import (
     validate_schema,
     optionally_keyed_by,
     Schema,
 )
+from taskgraph.util.taskcluster import get_artifact_path
 from mozbuild.schedules import INCLUSIVE_COMPONENTS
 
 from voluptuous import (
     Any,
     Optional,
     Required,
     Exclusive,
 )
@@ -494,33 +495,44 @@ def setup_talos(config, tests):
         if config.params.is_try():
             extra_options.append('--branch-name')
             extra_options.append('try')
 
         yield test
 
 
 @transforms.add
+def handle_artifact_prefix(config, tests):
+    """Handle translating `artifact_prefix` appropriately"""
+    for test in tests:
+        if test['build-attributes'].get('artifact_prefix'):
+            test.setdefault("attributes", {}).setdefault(
+                'artifact_prefix', test['build-attributes']['artifact_prefix']
+            )
+        yield test
+
+
+@transforms.add
 def set_target(config, tests):
     for test in tests:
         build_platform = test['build-platform']
         target = None
         if 'target' in test:
             resolve_keyed_by(test, 'target', item_name=test['test-name'])
             target = test['target']
         if not target:
             if build_platform.startswith('macosx'):
                 target = 'target.dmg'
             elif build_platform.startswith('android'):
                 target = 'target.apk'
             elif build_platform.startswith('win'):
                 target = 'target.zip'
             else:
                 target = 'target.tar.bz2'
-        test['mozharness']['build-artifact-name'] = 'public/build/' + target
+        test['mozharness']['build-artifact-name'] = get_artifact_path(test, target)
 
         yield test
 
 
 @transforms.add
 def set_treeherder_machine_platform(config, tests):
     """Set the appropriate task.extra.treeherder.machine.platform"""
     translation = {