]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Check shaman not only for repo but for build complete 1577/head
authorDan Mick <dmick@redhat.com>
Mon, 2 Nov 2020 22:11:26 +0000 (22:11 +0000)
committerDan Mick <dmick@redhat.com>
Mon, 9 Nov 2020 21:57:48 +0000 (21:57 +0000)
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 <dmick@redhat.com>
teuthology/packaging.py
teuthology/suite/util.py

index 22eddfb4565bc4031b44dc4b417befdfe606aaf4..11e29f1eb25a381fbdf6df0b50a5734b69ea3f0d 100644 (file)
@@ -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()
index 90d6648909a66b2db18c3ac55adb2d30241efe0a..5b9cb29f7de9489b67a36ab7f5c752ad15c3dd94 100644 (file)
@@ -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