osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39991?usp=email )
Change subject: testenv: clone_project: fix getting latest version ...................................................................... testenv: clone_project: fix getting latest version Extend the logic for getting the last version, so it doesn't only work with libosmo-sigtran (where the last version happens to be the last one returned by "git ls-remote --tags") but also for libosmocore where this isn't the case. Filter the versions by the relevant ones and then sort them to get the highest one. Change-Id: Ic15e385b9c8bab5c0dc70276049d6ad5ae927a6a --- M _testenv/testenv/podman_install.py 1 file changed, 11 insertions(+), 1 deletion(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/_testenv/testenv/podman_install.py b/_testenv/testenv/podman_install.py index 1eaf7e8..27b08b4 100644 --- a/_testenv/testenv/podman_install.py +++ b/_testenv/testenv/podman_install.py @@ -3,6 +3,8 @@ import logging import multiprocessing import os +import packaging.version +import re import shlex import string import subprocess @@ -103,7 +105,15 @@ url = f"https://gerrit.osmocom.org/{project}" if testenv.args.binary_repo.endswith(":latest"): ls_remote = testenv.cmd.run(["git", "ls-remote", "--tags", url], capture_output=True, text=True) - branch = ls_remote.stdout.split("\n")[-2].split("refs/tags/")[1].split("^")[0] + tags = [] + pattern = re.compile("^\d+\.\d+\.\d+$") + for line in ls_remote.stdout.split("\n"): + if "refs/tags/" in line: + tag = line.split("refs/tags/")[1].split("^")[0] + if pattern.match(tag): + tags += [tag] + tags.sort(key=packaging.version.Version, reverse=True) + branch = tags[0] logging.info(f"{project}: cloning {branch}") testenv.cmd.run( -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39991?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ic15e385b9c8bab5c0dc70276049d6ad5ae927a6a Gerrit-Change-Number: 39991 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osm...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de> Gerrit-Reviewer: osmith <osm...@sysmocom.de> Gerrit-Reviewer: pespin <pes...@sysmocom.de>