Skip to content

Commit a808faf

Browse files
committed
suite: Check for containers for cephadm jobs
As opposed to always Signed-off-by: Zack Cerza <zack@cerza.org>
1 parent 6120c57 commit a808faf

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

teuthology/suite/run.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,15 @@ def collect_jobs(self, arch, configs, newest=False, limit=0):
549549
# no point in continuing the search
550550
if newest:
551551
return jobs_missing_packages, []
552+
job_tasks = set()
553+
for task_dict in parsed_yaml.get('tasks', []):
554+
for key in task_dict.keys():
555+
job_tasks.add(key)
556+
if any(['cephadm' in name for name in job_tasks]):
557+
if not util.container_image_for_hash(sha1):
558+
jobs_missing_packages.append(job)
559+
if newest:
560+
return jobs_missing_packages, []
552561

553562
jobs_to_schedule.append(job)
554563
return jobs_missing_packages, jobs_to_schedule

teuthology/suite/util.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,6 @@ def package_version_for_hash(hash, flavor='default', distro='rhel',
243243
),
244244
)
245245

246-
if not container_image_for_hash(hash):
247-
log.info("Container build incomplete")
248-
return None
249-
250246
try:
251247
return bp.version
252248
except VersionNotFoundError:

teuthology/util/containers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import functools
12
import logging
23
import re
34
import requests
@@ -44,6 +45,7 @@ def resolve_container_image(image: str):
4445
return f"{domain}/{org}/{image}:{tag}"
4546

4647

48+
@functools.lru_cache()
4749
def container_image_exists(image: str):
4850
"""
4951
Use the Quay API to check for the existence of a container image.
@@ -53,7 +55,7 @@ def container_image_exists(image: str):
5355
assert match
5456
obj = match.groupdict()
5557
url = f"https://{obj['domain']}/api/v1/repository/{obj['org']}/{obj['image']}/tag?filter_tag_name=eq:{obj['tag']}"
56-
log.debug(f"Checking for container existence at: {url}")
58+
log.info(f"Checking for container existence at: {url}")
5759
resp = requests.get(url)
5860
return resp.ok and len(resp.json().get('tags')) >= 1
5961

@@ -70,3 +72,5 @@ def container_image_for_hash(hash: str, flavor='default', base_image='centos:9')
7072
image_spec = resolve_container_image(f":{tag}")
7173
if container_image_exists(image_spec):
7274
return image_spec
75+
else:
76+
log.error(f"Container image not found for hash '{hash}'")

0 commit comments

Comments
 (0)