зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1381577 - Part M; Refactor repackage taskgraph code to be more readable and make it easier to add windows. r=kmoir
Land date changes to support windows nightlies onto central MozReview-Commit-ID: Bo0wVjGPcCN --HG-- extra : rebase_source : 88c999c4c3a56efb8db0a7c5eed0f546987e9428
This commit is contained in:
Родитель
858702b7f2
Коммит
146f0efc8e
|
@ -13,6 +13,9 @@ from taskgraph.util.schema import validate_schema, Schema
|
|||
from taskgraph.transforms.task import task_description_schema
|
||||
from voluptuous import Any, Required, Optional
|
||||
|
||||
_TC_ARTIFACT_LOCATION = \
|
||||
'https://queue.taskcluster.net/v1/task/{task_id}/artifacts/public/build/{postfix}'
|
||||
|
||||
transforms = TransformSequence()
|
||||
|
||||
# Voluptuous uses marker objects as dictionary *keys*, but they are not
|
||||
|
@ -113,60 +116,37 @@ def make_job_description(config, jobs):
|
|||
attributes = copy_attributes_from_dependent_job(dep_job)
|
||||
attributes['repackage_type'] = 'repackage'
|
||||
|
||||
locale = None
|
||||
if job.get('locale'):
|
||||
attributes['locale'] = job['locale']
|
||||
locale = job['locale']
|
||||
attributes['locale'] = locale
|
||||
|
||||
level = config.params['level']
|
||||
|
||||
task_env = {}
|
||||
locale_output_path = ""
|
||||
mar_prefix = 'https://queue.taskcluster.net/v1/task/' + \
|
||||
'{}/artifacts/public/build/host/bin/'.format(build_task_ref)
|
||||
if attributes['build_platform'].startswith('macosx'):
|
||||
if job.get('locale'):
|
||||
input_string = 'https://queue.taskcluster.net/v1/task/' + \
|
||||
'{}/artifacts/public/build/{}/target.tar.gz'
|
||||
input_string = input_string.format(signing_task_ref, job['locale'])
|
||||
locale_output_path = "{}/".format(job['locale'])
|
||||
else:
|
||||
input_string = 'https://queue.taskcluster.net/v1/task/' + \
|
||||
'{}/artifacts/public/build/target.tar.gz'.format(signing_task_ref)
|
||||
task_env.update(
|
||||
SIGNED_INPUT={'task-reference': input_string},
|
||||
UNSIGNED_MAR={'task-reference': "{}mar".format(mar_prefix)},
|
||||
)
|
||||
mozharness_config = ['repackage/osx_signed.py']
|
||||
output_files = [{
|
||||
'type': 'file',
|
||||
'path': '/home/worker/workspace/build/artifacts/target.dmg',
|
||||
'name': 'public/build/{}target.dmg'.format(locale_output_path),
|
||||
}, {
|
||||
'type': 'file',
|
||||
'path': '/home/worker/workspace/build/artifacts/target.complete.mar',
|
||||
'name': 'public/build/{}target.complete.mar'.format(locale_output_path),
|
||||
}]
|
||||
else:
|
||||
raise Exception("Unexpected build platform for repackage")
|
||||
|
||||
build_platform = attributes['build_platform']
|
||||
run = {
|
||||
'using': 'mozharness',
|
||||
'script': 'mozharness/scripts/repackage.py',
|
||||
'config': mozharness_config,
|
||||
'config': _generate_task_mozharness_config(build_platform),
|
||||
'job-script': 'taskcluster/scripts/builder/repackage.sh',
|
||||
'actions': ['download_input', 'setup', 'repackage'],
|
||||
'extra-workspace-cache-key': 'repackage',
|
||||
}
|
||||
|
||||
if attributes["build_platform"].startswith('macosx'):
|
||||
worker = {
|
||||
'docker-image': {"in-tree": "desktop-build"},
|
||||
'artifacts': output_files,
|
||||
'env': task_env,
|
||||
'chain-of-trust': True,
|
||||
'max-run-time': 3600
|
||||
}
|
||||
run["tooltool-downloads"] = 'internal'
|
||||
worker = {
|
||||
'env': _generate_task_env(build_platform, build_task_ref,
|
||||
signing_task_ref, locale=locale),
|
||||
'artifacts': _generate_task_output_files(build_platform, locale=locale),
|
||||
'chain-of-trust': True,
|
||||
'max-run-time': 3600,
|
||||
}
|
||||
|
||||
if build_platform.startswith('macosx'):
|
||||
worker_type = 'aws-provisioner-v1/gecko-%s-b-macosx64' % level
|
||||
|
||||
run['tooltool-downloads'] = 'internal'
|
||||
worker['docker-image'] = {"in-tree": "desktop-build"},
|
||||
|
||||
cot = job.setdefault('extra', {}).setdefault('chainOfTrust', {})
|
||||
cot.setdefault('inputs', {})['docker-image'] = {"task-reference": "<docker-image>"}
|
||||
|
||||
|
@ -185,3 +165,46 @@ def make_job_description(config, jobs):
|
|||
'run': run,
|
||||
}
|
||||
yield task
|
||||
|
||||
|
||||
def _generate_task_mozharness_config(build_platform):
|
||||
if build_platform.startswith('macosx'):
|
||||
return ['repackage/osx_signed.py']
|
||||
else:
|
||||
raise NotImplemented('Unsupported build_platform: "{}"'.format(build_platform))
|
||||
|
||||
|
||||
def _generate_task_env(build_platform, build_task_ref, signing_task_ref, locale=None):
|
||||
mar_prefix = _generate_taskcluster_prefix(build_task_ref, postfix='host/bin/', locale=None)
|
||||
signed_prefix = _generate_taskcluster_prefix(signing_task_ref, locale=locale)
|
||||
|
||||
if build_platform.startswith('macosx'):
|
||||
return {
|
||||
'SIGNED_INPUT': {'task-reference': '{}target.tar.gz'.format(signed_prefix)},
|
||||
'UNSIGNED_MAR': {'task-reference': '{}mar'.format(mar_prefix)},
|
||||
}
|
||||
else:
|
||||
raise NotImplemented('Unsupported build_platform: "{}"'.format(build_platform))
|
||||
|
||||
|
||||
def _generate_taskcluster_prefix(task_id, postfix='', locale=None):
|
||||
if locale:
|
||||
postfix = '{}/{}'.format(locale, postfix)
|
||||
|
||||
return _TC_ARTIFACT_LOCATION.format(task_id=task_id, postfix=postfix)
|
||||
|
||||
|
||||
def _generate_task_output_files(build_platform, locale=None):
|
||||
locale_output_path = '{}/'.format(locale) if locale else ''
|
||||
if build_platform.startswith('macosx'):
|
||||
return [{
|
||||
'type': 'file',
|
||||
'path': '/home/worker/workspace/build/artifacts/target.dmg',
|
||||
'name': 'public/build/{}target.dmg'.format(locale_output_path),
|
||||
}, {
|
||||
'type': 'file',
|
||||
'path': '/home/worker/workspace/build/artifacts/target.complete.mar',
|
||||
'name': 'public/build/{}target.complete.mar'.format(locale_output_path),
|
||||
}]
|
||||
else:
|
||||
raise NotImplemented('Unsupported build_platform: "{}"'.format(build_platform))
|
||||
|
|
Загрузка…
Ссылка в новой задаче