Bug 1415621: Refactor checking out vcs repos in taskcluster mozharness builds. draft
authorTom Prince <mozilla@hocat.ca>
Thu, 26 Oct 2017 12:03:23 -0600
changeset 695841 63537bd0105ef2f937d87b0abbc36516eaf5bec9
parent 695799 41a66272bd113526fa1e533268ebd5bbf39f7532
child 695842 12213932003200d61abb11b9ba1568e993c0645c
push id88563
push userbmo:mozilla@hocat.ca
push dateThu, 09 Nov 2017 22:42:20 +0000
bugs1415621
milestone58.0a1
Bug 1415621: Refactor checking out vcs repos in taskcluster mozharness builds. MozReview-Commit-ID: LyZ5bmEleoW
taskcluster/taskgraph/transforms/job/mozharness.py
--- a/taskcluster/taskgraph/transforms/job/mozharness.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness.py
@@ -243,24 +243,35 @@ def mozharness_on_generic_worker(config,
 
     for option in run.get('options', []):
         assert ' ' not in option
         mh_command.append('--' + option)
     if run.get('custom-build-variant-cfg'):
         mh_command.append('--custom-build-variant')
         mh_command.append(run['custom-build-variant-cfg'])
 
-    hg_command = ['"c:\\Program Files\\Mercurial\\hg.exe"']
-    hg_command.append('robustcheckout')
-    hg_command.extend(['--sharebase', 'y:\\hg-shared'])
-    hg_command.append('--purge')
-    hg_command.extend(['--upstream', 'https://hg.mozilla.org/mozilla-unified'])
-    hg_command.extend(['--revision', env['GECKO_HEAD_REV']])
-    hg_command.append(env['GECKO_HEAD_REPOSITORY'])
-    hg_command.append('.\\build\\src')
+    def checkout_repo(base_repo, head_repo, head_rev, path):
+        hg_command = ['"c:\\Program Files\\Mercurial\\hg.exe"']
+        hg_command.append('robustcheckout')
+        hg_command.extend(['--sharebase', 'y:\\hg-shared'])
+        hg_command.append('--purge')
+        hg_command.extend(['--upstream', base_repo])
+        hg_command.extend(['--revision', head_rev])
+        hg_command.append(head_repo)
+        hg_command.append(path)
+
+        return [
+            ' '.join(hg_command),
+        ]
+
+    hg_commands = checkout_repo(
+        base_repo=env['GECKO_BASE_REPOSITORY'],
+        head_repo=env['GECKO_HEAD_REPOSITORY'],
+        head_rev=env['GECKO_HEAD_REV'],
+        path='.\\build\\src')
 
     worker['command'] = []
     if taskdesc.get('needs-sccache'):
         worker['command'].extend([
             # Make the comment part of the first command, as it will help users to
             # understand what is going on, and why these steps are implemented.
             dedent('''\
             :: sccache currently uses the full compiler commandline as input to the
@@ -268,18 +279,18 @@ def mozharness_on_generic_worker(config,
             :: the symlink dir to get consistent paths.
             if exist z:\\build rmdir z:\\build'''),
             r'mklink /d z:\build %cd%',
             # Grant delete permission on the link to everyone.
             r'icacls z:\build /grant *S-1-1-0:D /L',
             r'cd /d z:\build',
         ])
 
+    worker['command'].extend(hg_commands)
     worker['command'].extend([
-        ' '.join(hg_command),
         ' '.join(mh_command)
     ])
 
 
 @run_job_using('buildbot-bridge', 'mozharness', schema=mozharness_run_schema)
 def mozharness_on_buildbot_bridge(config, job, taskdesc):
     run = job['run']
     worker = taskdesc['worker']