Commit d267bed7 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Heptapod CI: installing proper versions of HGitaly & py-heptapod

Heads up: in release branches, the tests are expected to pass
for the versions specified in `python/requirements.txt`.

Was spotted while working on the Gitaly prebuild, but really
has to be fixed: we were running the tests always against the
default branch of the Python dependencies (HGitaly and py-heptapod).

There is a complication with tags, and especially release
branches. For the latter, there is no simple way to know
which is the appropriate branch of the Python deps. Shortly
after the beginning of the release branch, it would clearly
be `default`, but after the swap of branches in the Rails app,
it would be `stable`.

For tags, the tests are run against the exact versions specified
in `python/requirements.txt`, that was easy.
For release branches, we just do the same. This is a lesser evil.
Hence now, pushes to release branches are expected to make the
appropriate version bumps (this was already quite often the case).

branch : heptapod-stable
parent e9eab32a7d58
......@@ -5,9 +5,12 @@ Expected to be run from a clone of the Rails application, and assumes
that `config/gitlab.yml` has already been initialized.
import os
import re
import subprocess
import sys
INTERPRETER = 'python3.8'
RELEASE_BRANCH_RX = re.compile(r'heptapod-\d+-\d+')
CWD = os.getcwd()
BASE_DIR = os.path.join(CWD, 'tmp', 'tests', 'hgitaly')
......@@ -49,6 +52,25 @@ print("Upgrading pip and setuptools")
subprocess.check_call((PIP_BIN, 'install', '--upgrade',
'pip', 'setuptools', 'wheel'))
CI_TAG = os.environ.get('CI_COMMIT_TAG')
# probably not set for tag pipelines:
CI_BRANCH = os.environ.get('CI_COMMIT_HG_BRANCH', '')
print("*** ATTENTION Pipeline running for a tag or a release branch ***")
print("*** ==> installing the fixed `python/requirements.txt` ***")
# just install the fixed deps, that's what is meant
subprocess.check_call((PIP_BIN, 'install', '--upgrade',
'-r', 'python/requirements.txt'))
hepta_mod = subprocess.check_output(
(INTERPRETER, '-c', 'import heptapod; print(heptapod.__file__)'),
write_config(os.path.join(os.path.dirname(hepta_mod), 'required.hgrc'))
elif CI_BRANCH == 'heptapod-stable':
PYDEPS_BRANCH = 'stable'
PYDEPS_BRANCH = 'default'
print("Upgrading hg-evolve")
subprocess.check_call((PIP_BIN, 'install', '--upgrade', 'hg-evolve'))
......@@ -64,7 +86,8 @@ for slug, target in (('py-heptapod', PY_HEPTAPOD_CLONE_PATH),
if os.path.exists(target):
print("Updating %s clone at %s" % (slug, target))
subprocess.check_call(HG_CMD + ('-R', target, 'pull'))
subprocess.check_call(HG_CMD + ('-R', target, 'update', '-C', 'default'))
subprocess.check_call(HG_CMD + ('-R', target, 'update',
print("Cloning %s into %s" % (slug, target))
subprocess.check_call(HG_CMD + (
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