Bug 1385055 - Add taskgraph support for checking out comm-central and related branches. draft
authorTom Prince <mozilla@hocat.ca>
Thu, 27 Jul 2017 12:39:08 -0600
changeset 649623 bce6139373766b281a8ea76365e90de536697d16
parent 649622 7dddbd85047c6dc73ddbe1e423cd643a217845b3
child 727115 3b9d588c0b3866322bb98d3ed85c468f120bffe1
push id75073
push userbmo:mozilla@hocat.ca
push dateSun, 20 Aug 2017 22:21:51 +0000
bugs1385055
milestone57.0a1
Bug 1385055 - Add taskgraph support for checking out comm-central and related branches. MozReview-Commit-ID: 1eU567Cuc8a
taskcluster/taskgraph/transforms/job/common.py
taskcluster/taskgraph/transforms/job/mozharness.py
taskcluster/taskgraph/transforms/job/run_task.py
--- a/taskcluster/taskgraph/transforms/job/common.py
+++ b/taskcluster/taskgraph/transforms/job/common.py
@@ -68,16 +68,24 @@ def docker_worker_add_gecko_vcs_env_vars
     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'],
     })
 
+    if 'comm_base_repository' in config.params:
+        taskdesc['worker']['env'].update({
+            'COMM_BASE_REPOSITORY': config.params['comm_base_repository'],
+            'COMM_HEAD_REF': config.params['comm_head_rev'],
+            'COMM_HEAD_REPOSITORY': config.params['comm_head_repository'],
+            'COMM_HEAD_REV': config.params['comm_head_rev'],
+        })
+
 
 def support_vcs_checkout(config, job, taskdesc):
     """Update a job/task with parameters to enable a VCS checkout.
 
     The configuration is intended for tasks using "run-task" and its
     VCS checkout behavior.
     """
     level = config.params['level']
@@ -101,16 +109,25 @@ def support_vcs_checkout(config, job, ta
 
     taskdesc['worker'].setdefault('env', {}).update({
         'GECKO_BASE_REPOSITORY': config.params['base_repository'],
         'GECKO_HEAD_REPOSITORY': config.params['head_repository'],
         'GECKO_HEAD_REV': config.params['head_rev'],
         'HG_STORE_PATH': '~/checkouts/hg-store',
     })
 
+    if 'comm_base_repository' in config.params:
+        taskdesc['worker']['env'].update({
+            'COMM_BASE_REPOSITORY': config.params['comm_base_repository'],
+            'COMM_HEAD_REPOSITORY': config.params['comm_head_repository'],
+            'COMM_HEAD_REV': config.params['comm_head_rev'],
+        })
+    elif job['run']['comm-checkout']:
+        raise Exception("Can't checkout from comm-* repository if not given a repository.")
+
     # Give task access to hgfingerprint secret so it can pin the certificate
     # for hg.mozilla.org.
     taskdesc['scopes'].append('secrets:get:project/taskcluster/gecko/hgfingerprint')
 
     # only some worker platforms have taskcluster-proxy enabled
     if job['worker']['implementation'] in ('docker-worker', 'docker-engine'):
         taskdesc['worker']['taskcluster-proxy'] = True
 
--- a/taskcluster/taskgraph/transforms/job/mozharness.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness.py
@@ -87,16 +87,20 @@ mozharness_run_schema = Schema({
 
     # If false, don't set MOZ_SIMPLE_PACKAGE_NAME
     # Only disableable on windows
     Required('use-simple-package', default=True): bool,
 
     # If false don't pass --branch or --skip-buildbot-actions to mozharness script
     # Only disableable on windows
     Required('use-magic-mh-args', default=True): bool,
+
+    # if true, perform a checkout of a comm-central based branch inside the
+    # gecko checkout
+    Required('comm-checkout', default=False): bool,
 })
 
 
 @run_job_using("docker-worker", "mozharness", schema=mozharness_run_schema)
 def mozharness_on_docker_worker_setup(config, job, taskdesc):
     run = job['run']
 
     worker = taskdesc['worker']
@@ -181,22 +185,28 @@ def mozharness_on_docker_worker_setup(co
 
     command = [
         '/home/worker/bin/run-task',
         # Various caches/volumes are default owned by root:root.
         '--chown-recursive', '/home/worker/workspace',
         '--chown-recursive', '/home/worker/tooltool-cache',
         '--vcs-checkout', '/home/worker/workspace/build/src',
         '--tools-checkout', '/home/worker/workspace/build/tools',
-        '--',
     ]
-    command.append("/home/worker/workspace/build/src/{}".format(
-        run.get('job-script',
-                "taskcluster/scripts/builder/build-linux.sh"
-                )))
+
+    if run['comm-checkout']:
+        command.append('--comm-checkout=/home/worker/workspace/build/src/comm')
+
+    command += [
+        '--',
+        "/home/worker/workspace/build/src/{}".format(
+            run.get('job-script',
+                    "taskcluster/scripts/builder/build-linux.sh"
+                    )),
+    ]
 
     worker['command'] = command
 
 
 @run_job_using("generic-worker", "mozharness", schema=mozharness_run_schema)
 def mozharness_on_generic_worker(config, job, taskdesc):
     assert job['worker']['os'] == 'windows', 'only supports windows right now'
 
--- a/taskcluster/taskgraph/transforms/job/run_task.py
+++ b/taskcluster/taskgraph/transforms/job/run_task.py
@@ -17,16 +17,20 @@ run_task_schema = Schema({
 
     # if true, add a cache at ~worker/.cache, which is where things like pip
     # tend to hide their caches.  This cache is never added for level-1 jobs.
     Required('cache-dotcache', default=False): bool,
 
     # if true (the default), perform a checkout in /home/worker/checkouts/gecko
     Required('checkout', default=True): bool,
 
+    # if true, perform a checkout of a comm-central based branch inside the
+    # gecko checkout
+    Required('comm-checkout', default=False): bool,
+
     # The command arguments to pass to the `run-task` script, after the
     # checkout arguments.  If a list, it will be passed directly; otherwise
     # it will be included in a single argument to `bash -cx`.
     Required('command'): Any([basestring], basestring),
 })
 
 
 def common_setup(config, job, taskdesc):
@@ -51,16 +55,18 @@ def docker_worker_run_task(config, job, 
         })
 
     run_command = run['command']
     if isinstance(run_command, basestring):
         run_command = ['bash', '-cx', run_command]
     command = ['/home/worker/bin/run-task']
     if run['checkout']:
         command.append('--vcs-checkout=~/checkouts/gecko')
+    if run['comm-checkout']:
+        command.append('--comm-checkout=/home/worker/checkouts/gecko/comm')
     command.append('--fetch-hgfingerprint')
     command.append('--')
     command.extend(run_command)
     worker['command'] = command
 
 
 @run_job_using("native-engine", "run-task", schema=run_task_schema)
 def native_engine_run_task(config, job, taskdesc):