Bug 1381577 - Make artifact path setting more generic for windows worker. r=dustin draft
authorJustin Wood <Callek@gmail.com>
Mon, 17 Jul 2017 15:40:57 -0400
changeset 611721 d962204b415411afe1a1d06c7e697034ae72432b
parent 611720 1027a4efbc245bbc0d1be711356c16bd1a50d0d5
child 611722 1d2746c1def487c562689e4abd15ceec9d2ff8b6
push id69287
push userCallek@gmail.com
push dateThu, 20 Jul 2017 01:11:37 +0000
reviewersdustin
bugs1381577
milestone56.0a1
Bug 1381577 - Make artifact path setting more generic for windows worker. r=dustin Land date changes to support windows nightlies onto central MozReview-Commit-ID: BwBvzr46d20
taskcluster/taskgraph/transforms/job/common.py
taskcluster/taskgraph/transforms/job/mozharness.py
--- a/taskcluster/taskgraph/transforms/job/common.py
+++ b/taskcluster/taskgraph/transforms/job/common.py
@@ -40,24 +40,34 @@ def docker_worker_add_tc_vcs_cache(confi
     taskdesc['worker'].setdefault('caches', []).append({
         'type': 'persistent',
         'name': 'level-{}-{}-tc-vcs'.format(
             config.params['level'], config.params['project']),
         'mount-point': "/home/worker/.tc-vcs",
     })
 
 
-def docker_worker_add_public_artifacts(config, job, taskdesc):
+def add_public_artifacts(config, job, taskdesc, path):
     taskdesc['worker'].setdefault('artifacts', []).append({
         'name': 'public/build',
-        'path': '/home/worker/artifacts/',
+        'path': path,
         'type': 'directory',
     })
 
 
+def docker_worker_add_public_artifacts(config, job, taskdesc):
+    """ Adds a public artifact directory to the task """
+    add_public_artifacts(config, job, taskdesc, path='/home/worker/artifacts/')
+
+
+def generic_worker_add_public_artifacts(config, job, taskdesc):
+    """ Adds a public artifact directory to the task """
+    add_public_artifacts(config, job, taskdesc, path=r'public/build')
+
+
 def docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc):
     """Add the GECKO_BASE_* and GECKO_HEAD_* env vars to the worker."""
     env = taskdesc['worker'].setdefault('env', {})
     env.update({
         'GECKO_BASE_REPOSITORY': config.params['base_repository'],
         'GECKO_HEAD_REF': config.params['head_rev'],
         'GECKO_HEAD_REPOSITORY': config.params['head_repository'],
         'GECKO_HEAD_REV': config.params['head_rev'],
--- a/taskcluster/taskgraph/transforms/job/mozharness.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness.py
@@ -17,16 +17,17 @@ from taskgraph.util.schema import Schema
 from voluptuous import Required, Optional, Any
 
 from taskgraph.transforms.job import run_job_using
 from taskgraph.transforms.job.common import (
     docker_worker_add_workspace_cache,
     docker_worker_add_gecko_vcs_env_vars,
     docker_worker_setup_secrets,
     docker_worker_add_public_artifacts,
+    generic_worker_add_public_artifacts,
     support_vcs_checkout,
 )
 
 COALESCE_KEY = 'builds.{project}.{name}'
 
 mozharness_run_schema = Schema({
     Required('using'): 'mozharness',
 
@@ -192,20 +193,17 @@ def mozharness_on_generic_worker(config,
     if not run.get('keep-artifacts', True):
         invalid.append('keep-artifacts')
     if invalid:
         raise Exception("Jobs run using mozharness on Windows do not support properties " +
                         ', '.join(invalid))
 
     worker = taskdesc['worker']
 
-    worker['artifacts'] = [{
-        'path': r'public/build',
-        'type': 'directory',
-    }]
+    generic_worker_add_public_artifacts(config, job, taskdesc)
 
     docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc)
 
     env = worker['env']
     env.update({
         'MOZ_BUILD_DATE': config.params['moz_build_date'],
         'MOZ_SCM_LEVEL': config.params['level'],
         'MOZ_AUTOMATION': '1',