mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 04:06:42 +00:00
The Docker updater watches image plus version, the repository updater repository plus ref. Twelve pins fell outside both - an app_version, a release, a tag in a registry neither speaks - so nothing ever told anyone they had gone stale. Such a pin now names its upstream next to itself in an `update:` block: git_tags, registry_tags, npm, http_regex or a role-local script, with `match` selecting a tag flavour and `strip` removing a prefix the pin does not carry. utils/update/source.py resolves them beside the two existing updaters, `python -m cli.contributing.update.source` bumps them, the update-version-sources job opens one PR per role, and tests/external/update/source warns while a bump is pending. Two lints hold the rule: every semver pin is watched by one of the three updaters or opted out with a reason, and a semver only ever sits behind `version`, `<what>_version` or `ref` - which renames moodle's release to app_version and simpleicons' local_version to local_tag, the latter being the tag of a locally built image rather than an upstream version. A declaration naming a key the entity does not carry, or a type the resolver does not know, fails the lint instead of resolving nothing in silence. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
63 lines
1.6 KiB
Python
Executable File
63 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
from utils.update.source import apply_updates, find_outdated_updates
|
|
|
|
from . import PROJECT_ROOT
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(
|
|
description=(
|
|
"Update version pins that declare their upstream in an `update:` "
|
|
"block of roles/*/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("Declared version sources are already up to date.")
|
|
return 0
|
|
|
|
print("Planned version source updates:")
|
|
for update in updates:
|
|
entry = update.entry
|
|
rel_path = entry.config_path.relative_to(repo_root)
|
|
print(
|
|
f"- {rel_path}:{entry.line} {entry.role}/{entry.entity}.{entry.key} "
|
|
f"{entry.current} -> {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())
|