From ca39c407dd7a04e1917802c92af0415cec409fc3 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sat, 27 Apr 2019 21:56:47 +0000 Subject: [PATCH] Bug 1545368 - Support fetches in run-task on generic-worker. r=tomprince Differential Revision: https://phabricator.services.mozilla.com/D28048 --HG-- extra : moz-landing-system : lando --- taskcluster/scripts/run-task | 4 ++++ .../taskgraph/transforms/job/run_task.py | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/taskcluster/scripts/run-task b/taskcluster/scripts/run-task index e4ca8c50d8b4..0f8d7007f069 100755 --- a/taskcluster/scripts/run-task +++ b/taskcluster/scripts/run-task @@ -495,6 +495,10 @@ def fetch_artifacts(): 'scripts', 'misc', 'fetch-content') if not fetch_content or not os.path.isfile(fetch_content): + fetch_content = os.path.join(os.path.dirname(__file__), + 'fetch-content') + + if not os.path.isfile(fetch_content): print(FETCH_CONTENT_NOT_FOUND) sys.exit(1) diff --git a/taskcluster/taskgraph/transforms/job/run_task.py b/taskcluster/taskgraph/transforms/job/run_task.py index 93bd2aef0ad6..a2fa4227b857 100644 --- a/taskcluster/taskgraph/transforms/job/run_task.py +++ b/taskcluster/taskgraph/transforms/job/run_task.py @@ -81,9 +81,11 @@ worker_defaults = { } -def run_task_url(config): - return '{}/raw-file/{}/taskcluster/scripts/run-task'.format( - config.params['head_repository'], config.params['head_rev']) +def script_url(config, script): + return '{}/raw-file/{}/taskcluster/scripts/{}'.format( + config.params['head_repository'], + config.params['head_rev'], + script) @run_job_using("docker-worker", "run-task", schema=run_task_schema, defaults=worker_defaults) @@ -141,10 +143,17 @@ def generic_worker_run_task(config, job, taskdesc): }) worker['mounts'].append({ 'content': { - 'url': run_task_url(config), + 'url': script_url(config, 'run-task'), }, 'file': './run-task', }) + if worker.get('env', {}).get('MOZ_FETCHES'): + worker['mounts'].append({ + 'content': { + 'url': script_url(config, 'misc/fetch-content'), + }, + 'file': './fetch-content', + }) run_command = run['command'] if isinstance(run_command, basestring):