Builtin operator images were rebuilt four times after 2026-06-29 but the catalog kept the first digests: recording a release was a manual step that nothing ran. Once the old tags were pruned from CCR, 66 builtin operators pointed at manifests that no longer exist. - build-poc-images-kaniko.sh now runs record_operator_releases.py after operator builds (POC_KANIKO_RECORD_RELEASES, default true): it resolves each pushed tag to its digest, writes release.json with the stable :builtin tag, regenerates the catalog and repository manifests, then runs verify_operator_image_digests.py on the built operators. - verify_operator_image_digests.py fails when any pinned catalog digest is missing from the registry (usable in CI / before deploys). - sync_live_builtin_operator_images.py promotes catalog digests to a running platform (the API keeps live digests over the catalog), only after confirming each digest exists; dry run unless --apply. - scripts/lib/registry_client.py parses repo:tag@sha256 references and handles CCR's Bearer token challenge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
2.4 KiB
Python
70 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Fail when a builtin operator's pinned image digest is missing from the registry.
|
|
|
|
Checks every digest-pinned imageId in internal/api/builtin_operators_catalog.json (the
|
|
digests the API seeds) with a manifest HEAD request. Needs REGISTRY_USERNAME /
|
|
REGISTRY_PASSWORD with pull access.
|
|
|
|
Usage:
|
|
verify_operator_image_digests.py [--slug SLUG ...] [--json]
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
import pathlib
|
|
import sys
|
|
|
|
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "scripts" / "lib"))
|
|
|
|
from registry_client import RegistryClient, parse_image_reference # noqa: E402
|
|
|
|
CATALOG_PATH = ROOT / "internal" / "api" / "builtin_operators_catalog.json"
|
|
|
|
|
|
def pinned_images(catalog: list[dict], slugs: set[str]) -> list[tuple[str, str]]:
|
|
pinned = []
|
|
for item in catalog:
|
|
if item.get("type") != "builtin":
|
|
continue
|
|
slug = str(item["id"]).removeprefix("operator-builtin-").replace("-", "_")
|
|
if slugs and slug not in slugs:
|
|
continue
|
|
image_id = str(item.get("imageId") or "").strip()
|
|
if "@sha256:" in image_id:
|
|
pinned.append((slug, image_id))
|
|
return sorted(pinned)
|
|
|
|
|
|
def check(pinned: list[tuple[str, str]], head) -> list[dict]:
|
|
missing = []
|
|
for slug, image_id in pinned:
|
|
status, _ = head(parse_image_reference(image_id))
|
|
if status != 200:
|
|
missing.append({"slug": slug, "imageId": image_id, "status": status})
|
|
return missing
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
parser.add_argument("--slug", action="append", default=[], help="limit to these operator slugs")
|
|
parser.add_argument("--json", action="store_true", help="print missing images as JSON")
|
|
args = parser.parse_args()
|
|
|
|
catalog = json.loads(CATALOG_PATH.read_text(encoding="utf-8"))
|
|
pinned = pinned_images(catalog, {slug.replace("-", "_") for slug in args.slug})
|
|
missing = check(pinned, RegistryClient().head_manifest)
|
|
if args.json:
|
|
print(json.dumps(missing, ensure_ascii=False, indent=1))
|
|
else:
|
|
for item in missing:
|
|
print(f"MISSING {item['slug']}: {item['imageId']} (HTTP {item['status']})")
|
|
print(f"checked {len(pinned)} pinned builtin operator image(s), {len(missing)} missing")
|
|
return 1 if missing else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|