Skip component releases published without binary artifacts (#13381)

* Skip component releases published without binary artifacts

Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com>

* Don't use intermediate variable

Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com>

* Fail update-hashes when a component only returns 404s

Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com>

---------

Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com>
This commit is contained in:
Ali Afsharzadeh
2026-09-08 10:20:32 +00:00
committed by GitHub
parent 5ca00279b8
commit bf2727f6fd
@@ -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)