From bf2727f6fdc1d39a92b4f22d2c6725269e52de08 Mon Sep 17 00:00:00 2001 From: Ali Afsharzadeh Date: Tue, 8 Sep 2026 13:50:32 +0330 Subject: [PATCH] Skip component releases published without binary artifacts (#13381) * Skip component releases published without binary artifacts Signed-off-by: Ali Afsharzadeh * Don't use intermediate variable Signed-off-by: Ali Afsharzadeh * Fail update-hashes when a component only returns 404s Signed-off-by: Ali Afsharzadeh --------- Signed-off-by: Ali Afsharzadeh --- .../src/component_hash_update/download.py | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/scripts/component_hash_update/src/component_hash_update/download.py b/scripts/component_hash_update/src/component_hash_update/download.py index 0ef799cf4..24776da4e 100644 --- a/scripts/component_hash_update/src/component_hash_update/download.py +++ b/scripts/component_hash_update/src/component_hash_update/download.py @@ -250,13 +250,30 @@ def download_hash(downloads: {str: {str: Any}}) -> None: ).hexdigest() return hash_file.content.decode().split()[0] + skipped_404 = set() + fetched = set() for component, versions in chain(new_versions.items(), hash_set_to_0.items()): c = component + "_checksums" for arch in components_supported_arch[component]: for version in versions: - data[c][arch][ - str(version) - ] = f"{downloads[component].get('hashtype', 'sha256')}:{get_hash(component, version, arch)}" + # Some releases are published without binary artifacts + try: + data[c][arch][ + str(version) + ] = f"{downloads[component].get('hashtype', 'sha256')}:{get_hash(component, version, arch)}" + fetched.add(component) + except requests.exceptions.HTTPError as e: + if e.response is not None and e.response.status_code == 404: + logger.warning( + "Skipping %s %s (%s): release asset not found (404) at %s", + component, + version, + arch, + e.response.url, + ) + skipped_404.add(component) + continue + raise data[c] = { arch: { @@ -268,6 +285,15 @@ def download_hash(downloads: {str: {str: Any}}) -> None: for arch, versions in data[c].items() } + # Only 404s for a component means its release layout probably changed + all_missing = sorted(skipped_404 - fetched) + if all_missing: + logger.error( + "All hash fetches returned 404 for: %s", + ", ".join(all_missing), + ) + sys.exit(1) + with open(checksums_file, "w") as checksums_yml: yaml.dump(data, checksums_yml) logger.info("Updated %s", checksums_file)