Bug 1465181 - [taskgraph] Support use-artifacts with native-engine in run-task, r?dustin
Extends support of the use-artifacts key to native-engine based tasks.
MozReview-Commit-ID: FJILoyD5XVZ
--- a/taskcluster/taskgraph/transforms/job/common.py
+++ b/taskcluster/taskgraph/transforms/job/common.py
@@ -189,17 +189,17 @@ def docker_worker_add_tooltool(config, j
])
if internal:
taskdesc['scopes'].extend([
'docker-worker:relengapi-proxy:tooltool.download.internal',
])
-def docker_worker_use_artifacts(config, job, taskdesc, use_artifacts):
+def support_use_artifacts(config, job, taskdesc, use_artifacts):
"""Set a JSON object of artifact URLs in an environment variable.
This will tell the run-task script to download the artifacts.
"""
urls = {}
prefix = get_artifact_prefix(taskdesc)
for kind, artifacts in use_artifacts.items():
if kind not in taskdesc['dependencies']:
--- a/taskcluster/taskgraph/transforms/job/run_task.py
+++ b/taskcluster/taskgraph/transforms/job/run_task.py
@@ -4,17 +4,17 @@
"""
Support for running jobs that are invoked via the `run-task` script.
"""
from __future__ import absolute_import, print_function, unicode_literals
from taskgraph.transforms.job import run_job_using
from taskgraph.util.schema import Schema
-from taskgraph.transforms.job.common import support_vcs_checkout, docker_worker_use_artifacts
+from taskgraph.transforms.job.common import support_use_artifacts, support_vcs_checkout
from voluptuous import Required, Any
run_task_schema = Schema({
Required('using'): 'run-task',
# if true, add a cache at ~worker/.cache, which is where things like pip
# tend to hide their caches. This cache is never added for level-1 jobs.
Required('cache-dotcache'): bool,
@@ -46,48 +46,48 @@ run_task_schema = Schema({
def common_setup(config, job, taskdesc):
run = job['run']
if run['checkout']:
support_vcs_checkout(config, job, taskdesc,
sparse=bool(run['sparse-profile']))
+ if run['use-artifacts']:
+ support_use_artifacts(config, job, taskdesc, run['use-artifacts'])
+
taskdesc['worker'].setdefault('env', {})['MOZ_SCM_LEVEL'] = config.params['level']
def add_checkout_to_command(run, command):
if not run['checkout']:
return
command.append('--vcs-checkout=/builds/worker/checkouts/gecko')
if run['sparse-profile']:
command.append('--sparse-profile=build/sparse-profiles/%s' %
run['sparse-profile'])
-docker_defaults = {
+defaults = {
'cache-dotcache': False,
'checkout': True,
'comm-checkout': False,
'sparse-profile': None,
'use-artifacts': None,
}
-@run_job_using("docker-worker", "run-task", schema=run_task_schema, defaults=docker_defaults)
+@run_job_using("docker-worker", "run-task", schema=run_task_schema, defaults=defaults)
def docker_worker_run_task(config, job, taskdesc):
run = job['run']
worker = taskdesc['worker'] = job['worker']
common_setup(config, job, taskdesc)
- if run['use-artifacts']:
- docker_worker_use_artifacts(config, job, taskdesc, run['use-artifacts'])
-
if run.get('cache-dotcache'):
worker['caches'].append({
'type': 'persistent',
'name': 'level-{level}-{project}-dotcache'.format(**config.params),
'mount-point': '/builds/worker/.cache',
'skip-untrusted': True,
})
@@ -103,17 +103,17 @@ def docker_worker_run_task(config, job,
if run['comm-checkout']:
command.append('--comm-checkout=/builds/worker/checkouts/gecko/comm')
command.append('--fetch-hgfingerprint')
command.append('--')
command.extend(run_command)
worker['command'] = command
-@run_job_using("native-engine", "run-task", schema=run_task_schema)
+@run_job_using("native-engine", "run-task", schema=run_task_schema, defaults=defaults)
def native_engine_run_task(config, job, taskdesc):
run = job['run']
worker = taskdesc['worker'] = job['worker']
common_setup(config, job, taskdesc)
worker['context'] = '{}/raw-file/{}/taskcluster/scripts/run-task'.format(
config.params['head_repository'], config.params['head_rev']
)