Bug 1405408 - Part 0: Let toolchain tasks create non-public/build artifacts. r=dustin
authorNick Alexander <nalexander@mozilla.com>
Thu, 05 Oct 2017 16:02:20 -0700
changeset 679131 347192dde0ed068e46593b68d465c6d1e4cd8db7
parent 679130 831c287a4ae882823ec7411a00b05e88e69ebda2
child 679132 74e5d77b144db73cdeac30bfa2a323d0510817c1
push id84141
push userbmo:schien@mozilla.com
push dateThu, 12 Oct 2017 11:13:04 +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'],