From 8916a19a192846fb496ec3f290c5757a311e1547 Mon Sep 17 00:00:00 2001 From: Adam Saleh Date: Sep 15 2020 10:17:08 +0000 Subject: Fixed the version synchronisation code. --- diff --git a/monitor_gating/multi_builds.py b/monitor_gating/multi_builds.py index 7e7f66d..bf81400 100644 --- a/monitor_gating/multi_builds.py +++ b/monitor_gating/multi_builds.py @@ -182,7 +182,6 @@ def main(args, utils=None): nevr=nevr, name="resultsdb(phx)", url=conf["resultsdb"], - start=start_dg, ) # Check that resultsdb announced the new results diff --git a/monitor_gating/single_build.py b/monitor_gating/single_build.py index 735bbac..6fd308b 100644 --- a/monitor_gating/single_build.py +++ b/monitor_gating/single_build.py @@ -258,8 +258,6 @@ def main(args): nevr=nevr, name="resultsdb(phx)", url=conf["resultsdb"], - start=None, - duration=5 * 60, ) # Check that resultsdb announced the new results diff --git a/monitor_gating/utils.py b/monitor_gating/utils.py index ccf6b0d..14cdefb 100644 --- a/monitor_gating/utils.py +++ b/monitor_gating/utils.py @@ -600,7 +600,13 @@ class MonitoringUtils: for page in range(0, 9): end_url = url end_url += f"&page={page}" - data = requests.get(end_url).json() + try: + response = requests.get(end_url) + response.raise_for_status() + data = response.json() + except Exception as e: + self.print_user(f"WARNING: exception happened when querying resultsdb: {e.msg}", success=True) + continue for result in data["data"]: if nevr in result["data"]["nvr"]: success = True @@ -781,7 +787,6 @@ class MonitoringUtils: side_tag_name = self.create_side_tag(conf["fedpkg"], folder=gitfolder) target = side_tag_name if version: - version += version self.bump_release(name, version, folder=gitfolder) else: self.bump_release(name, version=0, folder=gitfolder) @@ -800,17 +805,16 @@ class MonitoringUtils: nevr_one = nevrs[package_one] nevr_two = nevrs[package_two] - if nevr_one.startswith(package_one): - release_one = nevr_one[len(package_one):] - version = int(re.search(r'\d+', nevr_one).group()) - - if nevr_two.startswith(package_two): - release_two = nevr_one[len(package_two):] + version_1, version_2 = [ + [int(x) for x in re.search(r'(\d+)-(\d+)', nevr).groups()] + for nevr in [nevr_one, nevr_two]] - if release_one != release_two: - return version, False + if version_1 == version_2: + return f"{version_1[0]}-{version_1[1]}", True - return version, True + if version_1 < version_2: + version_1 = version_2 + return f"{version_1[0]}-{version_1[1]+1}", False def run_command(command, cwd=None):