diff --git a/taskcluster/taskgraph/transforms/job/common.py b/taskcluster/taskgraph/transforms/job/common.py
index fd1ce2c953d0..467abbd440da 100644
--- a/taskcluster/taskgraph/transforms/job/common.py
+++ b/taskcluster/taskgraph/transforms/job/common.py
@@ -132,6 +132,34 @@ def support_vcs_checkout(config, job, taskdesc, sparse=False):
taskdesc['worker']['taskcluster-proxy'] = True
+def generic_worker_hg_commands(base_repo, head_repo, head_rev, path):
+ """Obtain commands needed to obtain a Mercurial checkout on generic-worker.
+
+ Returns two command strings. One performs the checkout. Another logs.
+ """
+ args = [
+ r'"c:\Program Files\Mercurial\hg.exe"',
+ 'robustcheckout',
+ '--sharebase', r'y:\hg-shared',
+ '--purge',
+ '--upstream', base_repo,
+ '--revision', head_rev,
+ head_repo,
+ path,
+ ]
+
+ logging_args = [
+ b":: TinderboxPrint:{revision}"
+ b"\n".format(
+ revision=head_rev,
+ source_repo=head_repo,
+ repo_name=head_repo.split('/')[-1]),
+ ]
+
+ return ' '.join(args), ' '.join(logging_args)
+
+
def docker_worker_setup_secrets(config, job, taskdesc):
"""Set up access to secrets via taskcluster-proxy. The value of
run['secrets'] should be a boolean or a list of secret names that
diff --git a/taskcluster/taskgraph/transforms/job/mozharness.py b/taskcluster/taskgraph/transforms/job/mozharness.py
index dd7a8cc7d4e3..bd0c5ae4f350 100644
--- a/taskcluster/taskgraph/transforms/job/mozharness.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness.py
@@ -24,6 +24,7 @@ from taskgraph.transforms.job.common import (
docker_worker_add_artifacts,
docker_worker_add_tooltool,
generic_worker_add_artifacts,
+ generic_worker_hg_commands,
support_vcs_checkout,
)
@@ -292,43 +293,20 @@ def mozharness_on_generic_worker(config, job, taskdesc):
mh_command.append('--custom-build-variant')
mh_command.append(run['custom-build-variant-cfg'])
- 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)
-
- logging_command = [
- b":: TinderboxPrint:{revision}\n".format(
- revision=head_rev,
- source_repo=head_repo,
- repo_name=head_repo.split('/')[-1],
- )]
-
- return [
- ' '.join(hg_command),
- ' '.join(logging_command),
- ]
-
- hg_commands = checkout_repo(
+ hg_commands = generic_worker_hg_commands(
base_repo=env['GECKO_BASE_REPOSITORY'],
head_repo=env['GECKO_HEAD_REPOSITORY'],
head_rev=env['GECKO_HEAD_REV'],
- path='.\\build\\src')
+ path=r'.\build\src',
+ )
if run['comm-checkout']:
hg_commands.extend(
- checkout_repo(
+ generic_worker_hg_commands(
base_repo=env['COMM_BASE_REPOSITORY'],
head_repo=env['COMM_HEAD_REPOSITORY'],
head_rev=env['COMM_HEAD_REV'],
- path='.\\build\\src\\comm')
- )
+ path=r'.\build\src\comm'))
worker['command'] = []
if taskdesc.get('needs-sccache'):
diff --git a/taskcluster/taskgraph/transforms/job/spidermonkey.py b/taskcluster/taskgraph/transforms/job/spidermonkey.py
index 70e3201b7d61..9478bbac5c73 100644
--- a/taskcluster/taskgraph/transforms/job/spidermonkey.py
+++ b/taskcluster/taskgraph/transforms/job/spidermonkey.py
@@ -14,6 +14,7 @@ from taskgraph.transforms.job import run_job_using
from taskgraph.transforms.job.common import (
docker_worker_add_artifacts,
generic_worker_add_artifacts,
+ generic_worker_hg_commands,
docker_worker_add_gecko_vcs_env_vars,
docker_worker_add_tooltool,
support_vcs_checkout,
@@ -115,20 +116,17 @@ def generic_worker_spidermonkey(config, job, taskdesc):
# Don't allow untested configurations yet
raise Exception("spidermonkey-rust-bindings is not a supported configuration")
- 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('.\\src')
+ hg_command = generic_worker_hg_commands(
+ 'https://hg.mozilla.org/mozilla-unified',
+ env['GECKO_HEAD_REPOSITORY'],
+ env['GECKO_HEAD_REV'],
+ r'.\src',
+ )[0]
command = ['c:\\mozilla-build\\msys\\bin\\bash.exe ' # string concat
'"./src/taskcluster/scripts/builder/%s"' % script]
- worker['command'] = []
- worker['command'].extend([
- ' '.join(hg_command),
- ' '.join(command)
- ])
+ worker['command'] = [
+ hg_command,
+ ' '.join(command),
+ ]
diff --git a/taskcluster/taskgraph/transforms/job/toolchain.py b/taskcluster/taskgraph/transforms/job/toolchain.py
index 70500c712758..dbf5688d1003 100644
--- a/taskcluster/taskgraph/transforms/job/toolchain.py
+++ b/taskcluster/taskgraph/transforms/job/toolchain.py
@@ -17,6 +17,7 @@ from taskgraph.transforms.job.common import (
docker_worker_add_gecko_vcs_env_vars,
docker_worker_add_artifacts,
docker_worker_add_tooltool,
+ generic_worker_hg_commands,
support_vcs_checkout,
)
from taskgraph.util.hash import hash_paths
@@ -205,15 +206,11 @@ def windows_toolchain(config, job, taskdesc):
'MOZ_AUTOMATION': '1',
})
- hg = r'c:\Program Files\Mercurial\hg.exe'
- hg_command = ['"{}"'.format(hg)]
- 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', '%GECKO_HEAD_REV%'])
- hg_command.append('%GECKO_HEAD_REPOSITORY%')
- hg_command.append('.\\build\\src')
+ hg_command = generic_worker_hg_commands(
+ 'https://hg.mozilla.org/mozilla-unified',
+ env['GECKO_HEAD_REPOSITORY'],
+ env['GECKO_HEAD_REV'],
+ r'.\build\src')[0]
# Use `mach` to invoke python scripts so in-tree libraries are available.
if run['script'].endswith('.py'):
@@ -225,7 +222,7 @@ def windows_toolchain(config, job, taskdesc):
bash = r'c:\mozilla-build\msys\bin\bash'
worker['command'] = [
- ' '.join(hg_command),
+ hg_command,
# do something intelligent.
r'{} build/src/taskcluster/scripts/misc/{}{}'.format(
bash, run['script'], args)