From d36cd1cf5c3250d81351ce8fb7c78b07985ad0cd Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Mon, 2 Nov 2020 22:11:26 +0000 Subject: [PATCH] Check shaman not only for repo but for build complete The package repo might be done, but the build must be totally complete for the container to be present. For a specific build (in global variables, for now), demand that the build be complete before claiming packages exist. This allows suite jobs to fail or --newest to continue searching when the container isn't done. Signed-off-by: Dan Mick --- teuthology/packaging.py | 32 ++++++++++++++++++++++++++++++++ teuthology/suite/util.py | 10 ++++++++++ 2 files changed, 42 insertions(+) diff --git a/teuthology/packaging.py b/teuthology/packaging.py index 22eddfb456..11e29f1eb2 100644 --- a/teuthology/packaging.py +++ b/teuthology/packaging.py @@ -970,6 +970,38 @@ class ShamanProject(GitbuilderProject): 'repo', ) + @property + def build_complete(self): + # use the repo search results to get a ref and a sha1; the + # input to teuthology-suite doesn't contain both + try: + self.assert_result() + except VersionNotFoundError: + return False + + search_result = self._result.json()[0] + + # now look for the build complete status + path = '/'.join( + ('builds/ceph', search_result['ref'], search_result['sha1']) + ) + build_url = urljoin(self.query_url, path) + + try: + resp = requests.get(build_url) + resp.raise_for_status() + except requests.HttpError: + return False + for build in resp.json(): + if ( + build['distro'] == search_result['distro'] and + build['distro_version'] == search_result['distro_version'] and + build['flavor'] == search_result['flavor'] and + build['distro_arch'] in search_result['archs'] + ): + return build['status'] == 'completed' + return False + def _get_repo(self): resp = requests.get(self.repo_url) resp.raise_for_status() diff --git a/teuthology/suite/util.py b/teuthology/suite/util.py index 90d6648909..5b9cb29f7d 100644 --- a/teuthology/suite/util.py +++ b/teuthology/suite/util.py @@ -25,6 +25,9 @@ from teuthology.task.install import get_flavor log = logging.getLogger(__name__) +CONTAINER_DISTRO = 'centos/8' # the one to check for build_complete +CONTAINER_FLAVOR = 'basic' # basic maps to default on shaman + def fetch_repos(branch, test_name): """ @@ -271,6 +274,13 @@ def package_version_for_hash(hash, kernel_flavor='basic', distro='rhel', sha1=hash, ), ) + + if bp.distro == CONTAINER_DISTRO and bp.flavor == CONTAINER_FLAVOR: + log.info('container build %s, checking for build_complete' % bp.distro) + if not bp.build_complete: + log.info('build not complete') + return None + return bp.version -- 2.39.5