fune/taskcluster/taskgraph/transforms/upload_generated_sources.py
Ted Mielczarek c4f93428a7 bug 1259832 - add a post-build task to upload generated source files. r=dustin
This change adds an upload-generated-sources task kind that runs after nightly
builds, fetches their `target.generated-files.tar.gz` artifact, and uploads
all the contained files to an S3 bucket. For actual nightly and release builds
on SCM level 3 trees, the S3 bucket is configured to be publicly accessible,
so that tools like Socorro will be able to fetch generated source files that
appear in crash reports, and debuggers will be able to fetch generated sources
when they show up while debugging Nightly or Release builds.

There are also level-2 and level-1 S3 buckets configured for builds happening
on trees of other levels such as try. They are not configured as publicly
accessible, but they exist so that these tasks can be tested in try.

MozReview-Commit-ID: Js1HRftbtep

--HG--
extra : rebase_source : b1172c9cc8b8be437d3b94a6bf0ff6b2f7d3508b
extra : source : 73bf88110b3821d62a3d393e85b56896a12f2930
2017-08-09 14:32:05 -04:00

43 lines
1.7 KiB
Python

# 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/.
"""
Transform the upload-generated-files task description template,
taskcluster/ci/upload-generated-sources/kind.yml
into an actual task description.
"""
from __future__ import absolute_import, print_function, unicode_literals
from taskgraph.transforms.base import TransformSequence
from taskgraph.util.taskcluster import get_artifact_url
transforms = TransformSequence()
@transforms.add
def add_task_info(config, jobs):
for job in jobs:
dep_task = job['dependent-task']
del job['dependent-task']
# Add a dependency on the build task.
job['dependencies'] = {'build': dep_task.label}
# Label the job to match the build task it's uploading from.
job['label'] = dep_task.label.replace("build-", "upload-generated-sources-")
# Copy over some bits of metdata from the build task.
dep_th = dep_task.task['extra']['treeherder']
job.setdefault('attributes', {})
job['attributes']['build_platform'] = dep_task.attributes.get('build_platform')
plat = '{}/{}'.format(dep_th['machine']['platform'], dep_task.attributes.get('build_type'))
job['treeherder']['platform'] = plat
job['treeherder']['tier'] = dep_th['tier']
# Add an environment variable pointing at the artifact from the build.
artifact_url = get_artifact_url('<build>',
'public/build/target.generated-files.tar.gz')
job['worker'].setdefault('env', {})['ARTIFACT_URL'] = {
'task-reference': artifact_url
}
yield job