2026-06-04 17:34:17 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Verify that every container image referenced in ci/main.go is reachable.
|
|
|
|
|
# Runs skopeo inspect (manifest-only, no layer pull) for each From("...") call.
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
ROOT=$(git rev-parse --show-toplevel)
|
|
|
|
|
FILE="$ROOT/ci/main.go"
|
|
|
|
|
|
2026-06-04 22:05:18 +02:00
|
|
|
# Static images from From("...") literals in ci/main.go
|
2026-06-05 09:00:26 +02:00
|
|
|
static_images=$(grep -oP 'From\("\K[^"]+' "$FILE" | grep -v ':$' | sort -u)
|
2026-06-04 22:05:18 +02:00
|
|
|
|
|
|
|
|
# Dynamic Flutter image derived from .fvmrc (not a literal in main.go)
|
|
|
|
|
FVMRC="$ROOT/.fvmrc"
|
|
|
|
|
flutter_version=$(python3 -c "import json; print(json.load(open('$FVMRC'))['flutter'])" 2>/dev/null || true)
|
|
|
|
|
flutter_image=""
|
|
|
|
|
if [ -n "$flutter_version" ]; then
|
|
|
|
|
flutter_image="ghcr.io/cirruslabs/flutter:$flutter_version"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
images=$(printf '%s\n%s\n' "$static_images" "$flutter_image" | grep -v '^$' | sort -u)
|
2026-06-04 17:34:17 +02:00
|
|
|
|
|
|
|
|
if [ -z "$images" ]; then
|
|
|
|
|
echo "check-ci-images: no From() image references found in $FILE"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
fail=0
|
|
|
|
|
while IFS= read -r image; do
|
|
|
|
|
printf "check-ci-images: %-55s" "$image"
|
|
|
|
|
if skopeo inspect --no-creds "docker://$image" > /dev/null 2>&1; then
|
|
|
|
|
echo "OK"
|
|
|
|
|
else
|
|
|
|
|
echo "NOT FOUND"
|
|
|
|
|
fail=1
|
|
|
|
|
fi
|
|
|
|
|
done <<< "$images"
|
|
|
|
|
|
|
|
|
|
if [ "$fail" -eq 1 ]; then
|
|
|
|
|
echo ""
|
|
|
|
|
echo "ERROR: one or more container images in ci/main.go could not be resolved."
|
|
|
|
|
echo "Fix the image tag before committing."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|