Files
computer-playbook/cli/contributing/docker/update_versions/__main__.py
T
kevinveenbirkenbachandClaude Opus 4.7 efacb56985 refactor(cli): retire one-shot fix tools, move docker version updater
Drop four one-shot or now-redundant tools from cli/fix/:

* vars_main_files — bulk-created vars/main.yml with application_id
  per role-prefix during the SPOT migration. The schema is now
  enforced declaratively by tests/integration/roles/applications/id/
  test_matches_role_name.py and the role-mapping SPOT lint.
* move_unnecessary_dependencies — moved meta dependencies to guarded
  include_role on first sweep. Permanent enforcement lives in
  tests/integration/roles/meta/dependencies/test_unnecessary.py.
* tabs — replaced literal tab characters with two-space indentation
  in YAML files. Autoformat covers new occurrences.
* ini_py — generic helper that filled missing __init__.py files; new
  packages now ship them from the start.

Move the remaining (still-actively-used) docker version updater out
from under cli/fix/ and into cli/contributing/, where the recurring
maintenance tooling lives:

* cli/fix/docker_image_versions → cli/contributing/docker/update_versions

Update the corresponding wiring:

* scripts/github/update_docker_image_versions.sh now calls
  python -m cli.contributing.docker.update_versions
  (the entry point invoked daily by .github/workflows/update.yml).
* docs/requirements/008-role-meta-layout.md references the new path.
* PROJECT_ROOT in __init__.py drops one parents[] level (the package
  sits one folder deeper now).

cli/fix/ is fully removed; new contributor-facing tooling belongs
under cli/contributing/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 16:19:42 +02:00

60 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python3
from __future__ import annotations
import argparse
from pathlib import Path
from utils.docker.version_updater import apply_updates, find_outdated_updates
from . import PROJECT_ROOT
def main() -> int:
parser = argparse.ArgumentParser(
description="Update semver-based Docker image versions in web-*/meta/services.yml."
)
parser.add_argument(
"--repo-root",
type=Path,
default=PROJECT_ROOT,
help="Repository root to scan and update",
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Print planned updates without modifying files",
)
args = parser.parse_args()
repo_root = args.repo_root.resolve()
updates = find_outdated_updates(repo_root)
if not updates:
print("Docker image versions are already up to date.")
return 0
print("Planned Docker image updates:")
for update in updates:
rel_path = update.entry.config_path.relative_to(repo_root)
print(
f"- {rel_path}:{update.entry.service} "
f"{update.entry.image} {update.entry.version} -> {update.latest}"
)
if args.dry_run:
return 0
changed_paths = apply_updates(updates)
if changed_paths:
print("\nUpdated files:")
for path in changed_paths:
print(f"- {path.relative_to(repo_root)}")
else:
print("\nNo files changed.")
return 0
if __name__ == "__main__":
raise SystemExit(main())