mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Folds the parallel Docker-image and git-ref version-update plumbing
into a single subsystem so the auto-update workflow, the external
freshness tests, and the unit tests all share one module layout.
utils/
update/
base.py # semver primitives shared by both backends
docker.py # OCI registry lookups + version: line rewriter
repository.py # git ls-remote walker + ref: line rewriter
cli/contributing/update/
docker/ # python -m cli.contributing.update.docker
repository/ # python -m cli.contributing.update.repository
scripts/github/update/
image_versions.sh
repository_refs.sh
Tests mirror the same shape under tests/{unit,external}/update/{docker,repository}/.
Also widens the Docker bump scope to all roles (previously gated on
`web-*`) so non-web roles like sys-svc-container get bumped too;
pins Bookwyrm's python image at 3.11-bookworm via
`# nocheck: docker-version` with a TODO until upstream supports
Python >= 3.12.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
60 lines
1.5 KiB
Python
Executable File
60 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
from utils.update.docker import apply_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(
|
|
"--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())
|