Commit 67280ef2 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Omnibus: stop hardcoding server-side path to hg

For server-side operations, we should use the one provided by
the server, obviously.

The immediate need is that it varies amongst installation types
With The new Omnibus packaging method (omnibus-heptapod!3)
for Heptapod 0.17, it changes from /usr/local/bin (expected to be on PATH)
to /opt/gitlab/embedded/bin.

There are several TODOs:

- read `hg_executable` from config, with remote instances being
  the only exceptions (but these wouldn't call server-side subprocesses
  from the tests).
- provide a direct helper method on `Heptapod`
- do the same for Git
parent ee0c40e91d6a
Pipeline #11121 failed with stages
in 19 seconds
......@@ -240,11 +240,12 @@ def test_push_corrupted_2(test_project, tmpdir):
# now, to reproduce, we'll strip Commit 2 directly from the remote.
# Not setting HGRCPATH in Heptapod >= 0.8 implies that the inner Git repo
# is untouched.
test_project.heptapod.run_shell(
('chpst', '-P', '-u', 'git',
'hg', '--config', 'extensions.strip=',
'-R', test_project.fs_path,
'strip', sha))
heptapod = test_project.heptapod
# TODO make a server-side hg method on Heptapod
heptapod.run_shell((heptapod.hg_executable,
'--config', 'extensions.strip=',
'-R', test_project.fs_path,
'strip', sha))
# let's be sure that GitLab still has Commit 2
branches = test_project.api_branches()
assert set(branches) == {'branch/default', 'topic/default/zetop'}
......
......@@ -63,6 +63,8 @@ class Heptapod:
"""Time to wait after we've had a first non error HTTP response.
"""
hg_executable = 'hg'
chrome_driver_args = ()
def __init__(self, url, ssh_user, ssh_port,
......@@ -482,6 +484,11 @@ class OmnibusHeptapod(Heptapod):
ssh_url = 'ssh://git@localhost'
# TODO read from conf for logical dependency loosening.
# Not an immediate priority, since we're not concerned about Python 2 any more,
# see heptapod#353.
hg_executable = '/opt/gitlab/embedded/bin/hg'
chrome_driver_args = ('--no-sandbox', )
def execute(self, command, user='git'):
......@@ -546,6 +553,8 @@ class DockerHeptapod(OmnibusHeptapod):
gitlab_ctl_command = ('gitlab-ctl', )
git_executable = 'git'
chrome_driver_args = ()
def __init__(self, docker_container, **kw):
......
......@@ -708,7 +708,7 @@ class Project(object):
:return: if ``section`` is passed, a simple ``dict``, otherwise a
``dict`` of ``dicts``. End values are always strings.
"""
cmd = ['hg', '-R', self.fs_path,
cmd = [self.heptapod.hg_executable, '-R', self.fs_path,
'--pager', 'false',
'config']
if section is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment