Files
computer-playbook/cli/contributing/update/galaxy/__main__.py
kevinveenbirkenbachandClaude Opus 5 e992175fcc feat(update): keep the pinned Ansible collections from ageing unnoticed
Pinning the collections froze them, and nothing thaws a pin: dependabot
reads pyproject.toml, the docker updater reads image tags, and neither
sees a version inside requirements/. The new job resolves upstream
releases with git ls-remote --tags and opens a PR the same way the pip,
image and repository-ref updaters do.

Both requirement files are bumped together, because the git fallback has
to install what the Galaxy file declares; moving only one would break
that. A collection whose two files disagree, or whose version is not a
semver, is left alone -- that covers the branch ref and the commit pin,
which state an intent a bumper must not guess.

The job calls pr.sh rather than role_prs.sh: the latter splits per
sub-directory and would open no PR at all for flat paths like
requirements/*.yml.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 20:58:35 +02:00

59 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
from __future__ import annotations
import argparse
from pathlib import Path
from utils.update.galaxy import apply_updates, find_outdated_updates
from . import PROJECT_ROOT
def main() -> int:
parser = argparse.ArgumentParser(
description=(
"Update pinned Ansible collection versions in requirements/ to their "
"latest upstream release tag."
)
)
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("Pinned Ansible collections are already up to date.")
return 0
print("Planned collection pin updates:")
for update in updates:
print(f"- {update.pin.fqcn} {update.pin.version} -> {update.latest}")
if args.dry_run:
return 0
changed_paths = apply_updates(repo_root, 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())