Files
kevinveenbirkenbachandClaude Opus 5.5 5892814384 fix(update): hold release groups whole and scan only rewritable compose pins
Address the CodeRabbit review on #2798: --compose refuses a --repo-root other than the checkout repository_files() lists; compose discovery skips the role tree, whose images meta/services.yml pins; a release group moves only when every member has its own candidate and all share a newer tag, on the role and compose paths alike; _compose_image_lines reports only image keys whose tagged value sits on the key line, the one form the writer rewrites.

🎯 Fix: 92 %
💥 Break: 4 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 88
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:20:22 +00:00

82 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python3
from __future__ import annotations
import argparse
from pathlib import Path
from utils.cache.files import repository_files
from utils.update.docker import (
apply_updates,
find_outdated_compose_updates,
find_outdated_updates,
)
from . import PROJECT_ROOT
def main() -> int:
parser = argparse.ArgumentParser(
description="Update semver-based Docker image versions in roles/*/meta/services.yml."
)
parser.add_argument(
"--compose",
action="store_true",
help=(
"Update the image tags of the tracked YAML files holding a compose "
"'services' mapping instead"
),
)
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()
if args.compose and repo_root != PROJECT_ROOT:
parser.error(
"--compose lists the tracked files of this checkout only; "
"drop --repo-root or run the command from the other checkout"
)
updates = (
find_outdated_compose_updates(repo_root, repository_files())
if args.compose
else 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())