Files
computer-playbook/scripts/meta/wait/mirrors.sh
kevinveenbirkenbachandClaude Opus 4.8 61477fb55d refactor(mirror): extract the wait-for-mirrors logic into a cli module
scripts/meta/wait/mirrors.sh embedded its logic as a `python - <<PY` heredoc
plus a bash skopeo/retry loop, and the heredoc imported iter_role_images from
utils.docker.image_discovery — a module that does not exist (it is
utils.docker.image.discovery). That raised ModuleNotFoundError, so the process
substitution yielded zero refs and the script logged "Nothing to wait for" and
exited 0, silently turning the fork-PR "wait for mirrored images" safeguard
into a no-op.

Move the whole thing into cli/contributing/mirror/wait/ (sibling to sync and
resolver): an argparse entrypoint that enumerates role images via
iter_role_images, computes each GHCR destination via GHCRProvider, and polls
GHCRProvider.tag_exists with --attempts/--sleep-seconds until all are present
or it times out. mirrors.sh becomes a thin env->args wrapper invoking
python -m cli.contributing.mirror.wait, matching scripts/meta/mirror/sync_missing.sh.

Behaviour is identical to the previous bash, minus the broken import.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 13:42:38 +02:00

21 lines
817 B
Bash
Executable File

#!/usr/bin/env bash
# Waits until every role-declared image has been mirrored to GHCR.
# Required env vars: GHCR_NAMESPACE, GHCR_REPOSITORY, GHCR_PREFIX, REPO_ROOT,
# IMAGE_WAIT_SLEEP_SECONDS, IMAGE_WAIT_ATTEMPTS
set -euo pipefail
: "${GHCR_NAMESPACE:?Missing GHCR_NAMESPACE}"
: "${GHCR_REPOSITORY:?Missing GHCR_REPOSITORY}"
: "${GHCR_PREFIX:?Missing GHCR_PREFIX}"
: "${REPO_ROOT:?Missing REPO_ROOT}"
: "${IMAGE_WAIT_SLEEP_SECONDS:?Missing IMAGE_WAIT_SLEEP_SECONDS}"
: "${IMAGE_WAIT_ATTEMPTS:?Missing IMAGE_WAIT_ATTEMPTS}"
python -m cli.contributing.mirror.wait \
--repo-root "${REPO_ROOT}" \
--ghcr-namespace "${GHCR_NAMESPACE}" \
--ghcr-repository "${GHCR_REPOSITORY}" \
--ghcr-prefix "${GHCR_PREFIX}" \
--attempts "${IMAGE_WAIT_ATTEMPTS}" \
--sleep-seconds "${IMAGE_WAIT_SLEEP_SECONDS}"