From 2ef260b51a517dd2b927c8abd11bb44129de7936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Thu, 26 Oct 2023 18:50:59 +0200 Subject: [PATCH 1/4] Release bci repositories per architecture independently There is no real good reason to wait for all the architectures to pass testing, so if there is one architecture finished, release it. --- gocd/bci_repo_publish.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gocd/bci_repo_publish.py b/gocd/bci_repo_publish.py index 77f874b0..b6373aa8 100755 --- a/gocd/bci_repo_publish.py +++ b/gocd/bci_repo_publish.py @@ -87,6 +87,8 @@ class BCIRepoPublisher(ToolBase.ToolBase): # Build the list of packages with metainfo packages = [] + # List of packages that have passed openQA + openqa_passed_packages = [] # As long as it's the same everywhere, hardcoding this list here # is easier and safer than trying to derive it from the package list. for arch in ('aarch64', 'ppc64le', 's390x', 'x86_64'): @@ -131,7 +133,6 @@ class BCIRepoPublisher(ToolBase.ToolBase): return # Check openQA results - openqa_passed = True for pkg in packages: passed = 0 pending = 0 @@ -146,20 +147,21 @@ class BCIRepoPublisher(ToolBase.ToolBase): else: self.logger.warning(f'https://openqa.suse.de/tests/{job["id"]} failed') failed += 1 - if passed == 0 or pending > 0 or failed > 0: - openqa_passed = False + self.logger.info(f'openQA did not (yet) pass for {pkg["name"]}: {passed}/{pending}/{failed}') + continue + openqa_passed_packages.append(pkg) - if not openqa_passed: - self.logger.info('No positive result from openQA (yet)') + if not openqa_passed_packages: + self.logger.info(f'No positive result from openQA (yet)') return # Trigger publishing if token is None: - self.logger.warning('Would publish now, but no token specified') + self.logger.warning(f'Would publish {[pkg["name"] for pkg in openqa_passed_packages]}, but no token specified') return - for pkg in packages: + for pkg in openqa_passed_packages: self.logger.info(f'Releasing {pkg["name"]}...') params = { 'project': pkg['build_prj'], 'package': pkg['name'], @@ -173,7 +175,7 @@ class BCIRepoPublisher(ToolBase.ToolBase): raise RuntimeError(f'Releasing failed: {req.text}') self.logger.info('Waiting for publishing to finish') - for pkg in packages: + for pkg in openqa_passed_packages: while not self.is_repo_published(pkg['publish_prj'], 'images'): self.logger.debug(f'Waiting for {pkg["publish_prj"]}') time.sleep(20) From 61561e6901f129ccb444498e78e1f90bc370d532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Thu, 26 Oct 2023 22:01:15 +0200 Subject: [PATCH 2/4] Wait a randomized interval --- gocd/bci_repo_publish.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gocd/bci_repo_publish.py b/gocd/bci_repo_publish.py index b6373aa8..c4c7de01 100755 --- a/gocd/bci_repo_publish.py +++ b/gocd/bci_repo_publish.py @@ -19,6 +19,7 @@ import re from lxml import etree as ET from openqa_client.client import OpenQA_Client from osc.core import http_GET, makeurl +from random import randint class BCIRepoPublisher(ToolBase.ToolBase): @@ -178,7 +179,7 @@ class BCIRepoPublisher(ToolBase.ToolBase): for pkg in openqa_passed_packages: while not self.is_repo_published(pkg['publish_prj'], 'images'): self.logger.debug(f'Waiting for {pkg["publish_prj"]}') - time.sleep(20) + time.sleep(randint(10, 30)) class CommandLineInterface(ToolBase.CommandLineInterface): From 40869a9102fbe76179c73baa23cde57f758ae92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Thu, 26 Oct 2023 22:01:34 +0200 Subject: [PATCH 3/4] Docstring improvements --- gocd/bci_repo_publish.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gocd/bci_repo_publish.py b/gocd/bci_repo_publish.py index c4c7de01..ef06aabd 100755 --- a/gocd/bci_repo_publish.py +++ b/gocd/bci_repo_publish.py @@ -60,7 +60,7 @@ class BCIRepoPublisher(ToolBase.ToolBase): return self.openqa.openqa_request('GET', 'jobs', values)['jobs'] def is_repo_published(self, project, repo, arch=None): - """Validates that the given prj/repo is fully published and all builds + """Validate that the given prj/repo is fully published and all builds have succeeded.""" result_filter = {'view': 'summary', 'repository': repo} if arch: @@ -197,8 +197,7 @@ class CommandLineInterface(ToolBase.CommandLineInterface): @cmdln.option('--token', help='The token for publishing. Does a dry run if not given.') def do_run(self, subcmd, opts, project): - """${cmd_name}: run the BCI repo publisher for the specified project, - e.g. 15-SP3 + """${cmd_name}: run BCI repo publisher for the project, e.g. 15-SP5. ${cmd_usage} ${cmd_option_list} From b5d1da48234a58c1b9b60e75dacd95e4a3997da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Fri, 27 Oct 2023 11:27:31 +0200 Subject: [PATCH 4/4] Only treat aarch64 and x86_64 as mandatory Other architectures will be released when no jobs can be found for them --- gocd/bci_repo_publish.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gocd/bci_repo_publish.py b/gocd/bci_repo_publish.py index ef06aabd..f594abde 100755 --- a/gocd/bci_repo_publish.py +++ b/gocd/bci_repo_publish.py @@ -134,6 +134,7 @@ class BCIRepoPublisher(ToolBase.ToolBase): return # Check openQA results + mandatory_arches = ('aarch64', 'x86_64') for pkg in packages: passed = 0 pending = 0 @@ -148,15 +149,14 @@ class BCIRepoPublisher(ToolBase.ToolBase): else: self.logger.warning(f'https://openqa.suse.de/tests/{job["id"]} failed') failed += 1 - if passed == 0 or pending > 0 or failed > 0: + if pending or failed: self.logger.info(f'openQA did not (yet) pass for {pkg["name"]}: {passed}/{pending}/{failed}') continue + if passed == 0 and pkg['arch'] in mandatory_arches: + self.logger.info('No positive result from openQA (yet)') + return openqa_passed_packages.append(pkg) - if not openqa_passed_packages: - self.logger.info(f'No positive result from openQA (yet)') - return - # Trigger publishing if token is None: self.logger.warning(f'Would publish {[pkg["name"] for pkg in openqa_passed_packages]}, but no token specified')