Set and make use of the TOOLS_DISTRO_SLUG environment variable in CI

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-09-29 09:15:23 +01:00 committed by Pedro Algarvio
parent 8c243a64de
commit 309829e5e3
2 changed files with 13 additions and 0 deletions

View file

@ -326,6 +326,18 @@ def _install_coverage_requirement(session):
coverage_requirement = COVERAGE_REQUIREMENT
if coverage_requirement is None:
coverage_requirement = "coverage==7.3.1"
if IS_LINUX:
distro_slug = os.environ.get("TOOLS_DISTRO_SLUG")
if distro_slug is not None and distro_slug in (
"centos-7",
"debian-10",
"photonos-3",
):
# Keep the old coverage requirement version since the new one, on these
# plaforms turns the test suite quite slow.
# Unit tests don't finish before the 5 hours timeout when they should
# finish within 1 to 2 hours.
coverage_requirement = "coverage==5.2"
session.install(
"--progress-bar=off", coverage_requirement, silent=PIP_INSTALL_SILENT
)

View file

@ -1331,6 +1331,7 @@ class VM:
if not env:
return
write_env = {k: str(v) for (k, v) in env.items()}
write_env["TOOLS_DISTRO_SLUG"] = self.name
write_env_filename = ".ci-env"
write_env_filepath = tools.utils.REPO_ROOT / ".ci-env"
write_env_filepath.write_text(json.dumps(write_env))