From: Dan Mick Date: Mon, 2 Nov 2020 22:11:26 +0000 (+0000) Subject: Check shaman not only for repo but for build complete X-Git-Tag: 1.1.0~35^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1577%2Fhead;p=teuthology.git 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 --- diff --git a/teuthology/packaging.py b/teuthology/packaging.py index 22eddfb45..11e29f1eb 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 90d664890..5b9cb29f7 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