Fix the downloading of the recent ccache archives

This commit is contained in:
Mikhail f. Shiryaev 2023-02-16 18:26:06 +01:00
parent 0ff404da9c
commit b349cda25c
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -77,10 +77,21 @@ def get_ccache_if_not_exists(
for pr_number in prs_to_check:
logging.info("Searching cache for pr %s", pr_number)
s3_path_prefix = str(pr_number) + "/ccaches"
objects = s3_helper.list_prefix(s3_path_prefix)
logging.info("Found %s objects for pr", len(objects))
for obj in objects:
if ccache_name in obj:
all_cache_objects = s3_helper.list_prefix(s3_path_prefix)
logging.info("Found %s objects for pr %s", len(all_cache_objects), pr_number)
objects = [obj for obj in all_cache_objects if ccache_name in obj]
if not objects:
continue
logging.info(
"Found ccache archives for pr %s: %s", pr_number, ", ".join(objects)
)
obj = objects[0]
# There are multiple possible caches, the newest one ends with .tar.zst
zst_cache = [obj for obj in objects if obj.endswith(".tar.zst")]
if zst_cache:
obj = zst_cache[0]
logging.info("Found ccache on path %s", obj)
url = f"{S3_DOWNLOAD}/{S3_BUILDS_BUCKET}/{obj}"
compressed_cache = os.path.join(temp_path, os.path.basename(obj))
@ -100,8 +111,6 @@ def get_ccache_if_not_exists(
cache_found = True
ccache_pr = pr_number
break
if cache_found:
break
if not cache_found:
logging.info("ccache not found anywhere, cannot download anything :(")