Files
computer-playbook/cli/contributing/mirror/resolver/__main__.py
T
kevinveenbirkenbachandClaude Opus 5.5 8a29ba0bfd fix(images): leave eol roles out of image discovery
The scheduled mirror job has failed every day since 2026-09-25 on the same two
images: quay.io/minio/minio and quay.io/minio/mc answer `unauthorized` to
anonymous pulls ("2/197 failed", run 38352569503). Both belong to
web-app-minio, an eol role outside the lifecycle envelope that default.env
tests, so no CI deploy pulls them.

iter_role_images now skips every role that is_maintained() reports as
unmaintained, the check the version updaters already apply to the same list.
On the tree the discovery yields 187 images instead of 192; the five it drops
belong to the four eol roles web-app-confluence, web-app-jira, web-app-minio
and web-app-phpldapadmin. The mirror sync, resolver and wait read this list,
and their descriptions and mirror.md now say so.

The roles directory is resolved first: is_maintained reads a relative path as
a role name and would keep every role.

475ab9b386 on feature/store-i18n takes the same approach with a lifecycle
reader of its own; main already has is_maintained for it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 01:19:28 +02:00

50 lines
1.3 KiB
Python

from __future__ import annotations
import argparse
import json
from pathlib import Path
from cli.contributing.mirror.providers import GHCRProvider
from utils.cache.yaml import dump_yaml_str
from utils.docker.image.discovery import iter_role_images
def main() -> int:
parser = argparse.ArgumentParser(
description=(
"Emit the mirrors.yml mapping that redirects every image a "
"non-eol role declares (applications.*.services.*) to its GHCR "
"mirror URI."
),
)
parser.add_argument("--repo-root", default=".")
GHCRProvider.add_args(parser)
parser.add_argument("--json", action="store_true")
args = parser.parse_args()
provider = GHCRProvider.from_args(args)
repo_root = Path(args.repo_root).resolve()
applications: dict = {}
for img in iter_role_images(repo_root):
app = applications.setdefault(img.role, {})
services = app.setdefault("services", {})
services[str(img.service)] = {
"image": provider.image_base(img),
"version": img.version,
}
result = {"applications": applications}
if args.json:
print(json.dumps(result, indent=2))
else:
print(dump_yaml_str(result))
return 0
if __name__ == "__main__":
raise SystemExit(main())