From 48a7799d9c602b377e4f9294d25809d03b18bc81 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Mon, 29 Jun 2026 07:58:09 -0400 Subject: [PATCH] Fix IndexError in _get_impacted_bundles when bundle has no brew image get_images_by_digest can return an empty list when a bundle path digest has no brew-built data in pyxis (e.g. Konflux-built bundles). We need to skip these instead of crashing with an IndexError on bundle_images[0]. We cannot rebuilt operator bundles which were not built in brew. Traceback: File "freshmaker/handlers/botas/botas_shipped_advisory.py", line 372, in _get_impacted_bundles bundle_nvr = bundle_images[0]["brew"]["build"] IndexError: list index out of range Assisted-by: Claude Opus 4.6 --- freshmaker/handlers/botas/botas_shipped_advisory.py | 6 ++++-- freshmaker/pyxis.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/freshmaker/handlers/botas/botas_shipped_advisory.py b/freshmaker/handlers/botas/botas_shipped_advisory.py index 6292da66..1eba087c 100644 --- a/freshmaker/handlers/botas/botas_shipped_advisory.py +++ b/freshmaker/handlers/botas/botas_shipped_advisory.py @@ -365,10 +365,12 @@ def _get_impacted_bundles(self, related_digests): for bundle in bundles: bundle_images = self._pyxis.get_images_by_digest(bundle["bundle_path_digest"]) if not bundle_images: - log.error( - "Image not found with bundle path digest: %s, ignore it.", + log.info( + "No brew image found for bundle path digest: %s, " + "skipping (likely a Konflux-built bundle).", bundle["bundle_path_digest"], ) + continue bundle_nvr = bundle_images[0]["brew"]["build"] log.debug("Found impacted bundle: %s", bundle_nvr) impacted_bundles.add(bundle_nvr) diff --git a/freshmaker/pyxis.py b/freshmaker/pyxis.py index 3a35c8ea..678a33e0 100644 --- a/freshmaker/pyxis.py +++ b/freshmaker/pyxis.py @@ -288,9 +288,10 @@ def get_images_by_digest(self, digest): :rtype: list """ q_filter = ( - f"repositories.manifest_list_digest=={digest}" + f"(repositories.manifest_list_digest=={digest}" + " or " - + f"repositories.manifest_schema2_digest=={digest}" + + f"repositories.manifest_schema2_digest=={digest})" + + " and brew != null" ) request_params = {"include": "data.brew,data.repositories", "filter": q_filter} return self._pagination("images", request_params)