mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-27 21:38:01 +00:00
Image names now follow {owner}/{repository}/mirror/{registry}/{name}
instead of {owner}/mirror/{registry}/{name}.
- GHCRProvider: add `repository` param + `add_args()`/`from_args()` classmethods
as SPOT for CLI argument registration and provider construction
- sync, resolver: use GHCRProvider.add_args() / from_args() (no duplication)
- Workflows: resolve repository name via scripts/meta/resolve/repository/name.sh
and pass --ghcr-repository to sync and publish
- mirrors.sh: require and forward GHCR_REPOSITORY env var
- deploy/development/mirrors.py: derive repository from GITHUB_REPOSITORY
- Tests: update expected paths, argv and env fixtures
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
from __future__ import annotations
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
import yaml
|
|
|
|
from utils.docker.image_discovery import iter_role_images
|
|
from cli.mirror.providers import GHCRProvider
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
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 = {}
|
|
|
|
for img in iter_role_images(repo_root):
|
|
app = applications.setdefault(img.role, {})
|
|
docker = app.setdefault("compose", {})
|
|
services = docker.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(yaml.safe_dump(result, sort_keys=False))
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|