Bug 1405408 - Part 0: Let toolchain tasks create non-public/build artifacts. r=dustin draft
authorNick Alexander <nalexander@mozilla.com>
Thu, 05 Oct 2017 16:02:20 -0700
changeset 678721 420f1e062583d315faa413181b1ac17c0e55249e
parent 678720 da701e7d5250f59f39e4b6262952a08d0068e9ac
child 678722 8346a0d9822834fe1ab2bb463c826cb15b69a0e9
push id84017
push usernalexander@mozilla.com
push dateWed, 11 Oct 2017 19:53:59 +0000
reviewersdustin
bugs1405408
milestone58.0a1
Bug 1405408 - Part 0: Let toolchain tasks create non-public/build artifacts. r=dustin There's code that carefully uses `setdefault('artifacts', [])` in the same file, but then stomps on 'artifacts' before that's invoked. This allows tasks to change where public/build is sourced from, and to add additional artifact locations (including private locations). MozReview-Commit-ID: JqyHew5bGv5
taskcluster/taskgraph/transforms/job/toolchain.py
--- a/taskcluster/taskgraph/transforms/job/toolchain.py
+++ b/taskcluster/taskgraph/transforms/job/toolchain.py
@@ -107,20 +107,24 @@ def add_optimization(config, run, taskde
 
 
 @run_job_using("docker-worker", "toolchain-script", schema=toolchain_run_schema)
 def docker_worker_toolchain(config, job, taskdesc):
     run = job['run']
     taskdesc['run-on-projects'] = ['trunk', 'try']
 
     worker = taskdesc['worker']
-    worker['artifacts'] = []
     worker['chain-of-trust'] = True
 
-    docker_worker_add_public_artifacts(config, job, taskdesc)
+    # Allow the job to specify where artifacts come from, but add
+    # public/build if it's not there already.
+    artifacts = worker.setdefault('artifacts', [])
+    if not any(artifact.get('name') == 'public/build' for artifact in artifacts):
+        docker_worker_add_public_artifacts(config, job, taskdesc)
+
     docker_worker_add_tc_vcs_cache(config, job, taskdesc)
     docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc)
     support_vcs_checkout(config, job, taskdesc, sparse=True)
 
     env = worker['env']
     env.update({
         'MOZ_BUILD_DATE': config.params['moz_build_date'],
         'MOZ_SCM_LEVEL': config.params['level'],