Bug 1405413 - Pre: Allow toolchain tasks to (un)set sparse-profile. r=glandium draft
authorNick Alexander <nalexander@mozilla.com>
Fri, 13 Oct 2017 10:27:37 -0700
changeset 680345 096a180238d1b5eeffbb0e2d9d538def162e877f
parent 680344 36ede48008703aa9be239f81ddeefb34441f32e8
child 680346 8c476377ded6b7177b3ba45f648431a08468948d
push id84480
push usernalexander@mozilla.com
push dateFri, 13 Oct 2017 22:37:46 +0000
reviewersglandium
bugs1405413
milestone58.0a1
Bug 1405413 - Pre: Allow toolchain tasks to (un)set sparse-profile. r=glandium Specifying anything but "toolchain-build" appears to have cache errors, which I cannot understand. These cache errors can be addressed in follow-up, if and when toolchain tasks require new sparse profiles. But specifying `null` avoids the sparse profile details entirely, which works nicely for `android-gradle-dependencies`, which is build-like and requires a fairly complete checkout. MozReview-Commit-ID: L3R8UIDjgqW
taskcluster/taskgraph/transforms/job/toolchain.py
--- a/taskcluster/taskgraph/transforms/job/toolchain.py
+++ b/taskcluster/taskgraph/transforms/job/toolchain.py
@@ -45,16 +45,23 @@ toolchain_run_schema = Schema({
         False,
         'public',
         'internal',
     ),
 
     # If true, tc-vcs will be enabled.  Not supported on Windows.
     Required('tc-vcs', default=True): bool,
 
+    # Sparse profile to give to checkout using `run-task`.  If given,
+    # a filename in `build/sparse-profiles`.  Defaults to
+    # "toolchain-build", i.e., to
+    # `build/sparse-profiles/toolchain-build`.  If `None`, instructs
+    # `run-task` to not use a sparse profile at all.
+    Required('sparse-profile', default='toolchain-build'): Any(basestring, None),
+
     # Paths/patterns pointing to files that influence the outcome of a
     # toolchain build.
     Optional('resources'): [basestring],
 
     # Path to the artifact produced by the toolchain job
     Required('toolchain-artifact'): basestring,
 
     # An alias that can be used instead of the real toolchain job name in
@@ -145,20 +152,25 @@ def docker_worker_toolchain(config, job,
         wrapper = 'workspace/build/src/mach python '
     else:
         wrapper = ''
 
     args = run.get('arguments', '')
     if args:
         args = ' ' + shell_quote(*args)
 
+    sparse_profile = []
+    if run.get('sparse-profile'):
+        sparse_profile = ['--sparse-profile',
+                          'build/sparse-profiles/{}'.format(run['sparse-profile'])]
+
     worker['command'] = [
         '/builds/worker/bin/run-task',
         '--vcs-checkout=/builds/worker/workspace/build/src',
-        '--sparse-profile', 'build/sparse-profiles/toolchain-build',
+    ] + sparse_profile + [
         '--',
         'bash',
         '-c',
         'cd /builds/worker && '
         '{}workspace/build/src/taskcluster/scripts/misc/{}{}'.format(
             wrapper, run['script'], args)
     ]