bug 1442793 - signed_artifacts artifact_prefix. r?bhearsum draft
authorAki Sasaki <asasaki@mozilla.com>
Wed, 07 Mar 2018 14:14:52 -0800
changeset 782026 b04655a6a5b965cc731236e38b973222ec801c4d
parent 782025 b6e11b8bcda2054dab119726ef0b138b2ce499ba
child 782027 d97c0517a40fa9825e84f1c9b0f939eb2999041d
push id106465
push userasasaki@mozilla.com
push dateSat, 14 Apr 2018 00:42:17 +0000
reviewersbhearsum
bugs1442793
milestone61.0a1
bug 1442793 - signed_artifacts artifact_prefix. r?bhearsum MozReview-Commit-ID: FYmqn67shHF
taskcluster/taskgraph/transforms/build_signing.py
taskcluster/taskgraph/transforms/nightly_l10n_signing.py
taskcluster/taskgraph/util/signed_artifacts.py
--- a/taskcluster/taskgraph/transforms/build_signing.py
+++ b/taskcluster/taskgraph/transforms/build_signing.py
@@ -4,16 +4,17 @@
 """
 Transform the signing task into an actual task description.
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 from taskgraph.transforms.base import TransformSequence
 from taskgraph.util.signed_artifacts import generate_specifications_of_artifacts_to_sign
+from taskgraph.util.taskcluster import get_artifact_path
 
 
 transforms = TransformSequence()
 
 
 @transforms.add
 def add_signed_routes(config, jobs):
     """Add routes corresponding to the routes of the build task
@@ -37,25 +38,26 @@ def add_signed_routes(config, jobs):
 
 @transforms.add
 def define_upstream_artifacts(config, jobs):
     for job in jobs:
         dep_job = job['dependent-task']
         build_platform = dep_job.attributes.get('build_platform')
 
         artifacts_specifications = generate_specifications_of_artifacts_to_sign(
-            build_platform,
-            dep_job.attributes.get('nightly'),
+            dep_job,
             keep_locale_template=False,
             kind=config.kind,
         )
 
         if 'android' in build_platform:
             # We're in the job that creates both multilocale and en-US APKs
-            artifacts_specifications[0]['artifacts'].append('public/build/en-US/target.apk')
+            artifacts_specifications[0]['artifacts'].append(
+                get_artifact_path(dep_job, 'en-US/target.apk')
+            )
 
         job['upstream-artifacts'] = [{
             'taskId': {'task-reference': '<build>'},
             'taskType': 'build',
             'paths': spec['artifacts'],
             'formats': spec['formats'],
         } for spec in artifacts_specifications]
 
--- a/taskcluster/taskgraph/transforms/nightly_l10n_signing.py
+++ b/taskcluster/taskgraph/transforms/nightly_l10n_signing.py
@@ -33,18 +33,17 @@ def make_signing_description(config, job
 
 
 @transforms.add
 def define_upstream_artifacts(config, jobs):
     for job in jobs:
         dep_job = job['dependent-task']
 
         locale_specifications = generate_specifications_of_artifacts_to_sign(
-            dep_job.attributes.get('build_platform'),
-            is_nightly=True,
+            dep_job,
             keep_locale_template=True
         )
 
         upstream_artifacts = []
         for spec in locale_specifications:
             upstream_artifacts.append({
                 'taskId': {'task-reference': '<unsigned-repack>'},
                 'taskType': 'l10n',
--- a/taskcluster/taskgraph/util/signed_artifacts.py
+++ b/taskcluster/taskgraph/util/signed_artifacts.py
@@ -1,59 +1,64 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # 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/.
 """
 Defines artifacts to sign before repackage.
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
+from taskgraph.util.taskcluster import get_artifact_path
 
 
 def generate_specifications_of_artifacts_to_sign(
-    build_platform, is_nightly=False, keep_locale_template=True, kind=None
+    task, keep_locale_template=True, kind=None
 ):
+    build_platform = task.attributes.get('build_platform')
+    is_nightly = task.attributes.get('nightly')
     if kind == 'release-source-signing':
         artifacts_specifications = [{
             'artifacts': [
-                'public/build/source.tar.xz'
+                get_artifact_path(task, 'source.tar.xz')
             ],
             'formats': ['gpg'],
         }]
     elif 'android' in build_platform:
         artifacts_specifications = [{
             'artifacts': [
-                'public/build/{locale}/target.apk',
+                get_artifact_path(task, '{locale}/target.apk'),
             ],
             'formats': ['jar'],
         }]
     # XXX: Mars aren't signed here (on any platform) because internals will be
     # signed at after this stage of the release
     elif 'macosx' in build_platform:
         artifacts_specifications = [{
-            'artifacts': ['public/build/{locale}/target.dmg'],
+            'artifacts': [get_artifact_path(task, '{locale}/target.dmg')],
             'formats': ['macapp', 'widevine'],
         }]
     elif 'win' in build_platform:
         artifacts_specifications = [{
             'artifacts': [
-                'public/build/{locale}/setup.exe',
+                get_artifact_path(task, '{locale}/setup.exe'),
             ],
             'formats': ['sha2signcode'],
         }, {
             'artifacts': [
-                'public/build/{locale}/target.zip',
+                get_artifact_path(task, '{locale}/target.zip'),
             ],
             'formats': ['sha2signcode', 'widevine'],
         }]
         if 'win32' in build_platform and is_nightly:
-            artifacts_specifications[0]['artifacts'] += ['public/build/{locale}/setup-stub.exe']
+            artifacts_specifications[0]['artifacts'] += [
+                get_artifact_path(task, '{locale}/setup-stub.exe')
+            ]
     elif 'linux' in build_platform:
         artifacts_specifications = [{
-            'artifacts': ['public/build/{locale}/target.tar.bz2'],
+            'artifacts': [get_artifact_path(task, '{locale}/target.tar.bz2')],
             'formats': ['gpg', 'widevine'],
         }]
     else:
         raise Exception("Platform not implemented for signing")
 
     if not keep_locale_template:
         artifacts_specifications = _strip_locale_template(artifacts_specifications)