Commit 727fa29e authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Heptapod CI: refactoring of hgitaly-test-build

Now there's a separate function to update configuration
files, will be useful for next change.

--HG--
branch : heptapod-stable
parent 56a1a392e87d
......@@ -20,6 +20,31 @@ HGITALY_CLONE_PATH = os.path.join(BASE_DIR, 'hgitaly')
HG_BIN = '/usr/local/bin/hg'
PIP_BIN = 'pip3.8'
def write_config(req_hgrc_path):
local_hgrc_path = os.path.join(CWD, 'config', 'tests.hgrc')
with open(local_hgrc_path, 'w') as local_hgrcf:
local_hgrcf.write("\n".join((
"[heptapod]",
"# we won't really send the pre- and post-receive hooks, ",
"# but `heptapod.hooks.Hook` is currently still instantiated and ",
"# that requires the configuration.",
"gitlab-internal-api-secret-file = " + os.path.join(
CWD, '.gitlab_shell_secret'),
"")))
yml_format = 'hgrc:\n - %s\n - %s\n bin_path: %s'
with open('config/gitlab.yml', 'r+') as conf:
out_lines = [line.replace('# hgrc:',
yml_format % (local_hgrc_path,
req_hgrc_path,
HG_BIN))
for line in conf.readlines()]
conf.seek(0)
conf.writelines(out_lines)
print("Upgrading pip and setuptools")
subprocess.check_call((PIP_BIN, 'install', '--upgrade',
'pip', 'setuptools', 'wheel'))
......@@ -59,26 +84,5 @@ pip_logging_cmd = (PIP_BIN, 'install', 'hg-loggingmod')
print("Installing hg-loggingmod: " + repr(pip_logging_cmd))
subprocess.check_call(pip_logging_cmd)
local_hgrc_path = os.path.join(CWD, 'config', 'tests.hgrc')
with open(local_hgrc_path, 'w') as local_hgrcf:
local_hgrcf.write("\n".join((
"[heptapod]",
"# we won't really send the pre- and post-receive hooks, ",
"# but `heptapod.hooks.Hook` is currently still instantiated and ",
"# that requires the configuration.",
"gitlab-internal-api-secret-file = " + os.path.join(CWD, '.gitlab_shell_secret'),
"")))
req_hgrc_path = os.path.join(PY_HEPTAPOD_CLONE_PATH,
'heptapod', 'required.hgrc')
yml_format = 'hgrc:\n - %s\n - %s\n bin_path: %s'
with open('config/gitlab.yml', 'r+') as conf:
out_lines = [l.replace('# hgrc:',
yml_format % (local_hgrc_path,
req_hgrc_path,
HG_BIN))
for l in conf.readlines()]
conf.seek(0)
conf.writelines(out_lines)
write_config(os.path.join(PY_HEPTAPOD_CLONE_PATH,
'heptapod', 'required.hgrc'))
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