2026-09-11 13:40:14 -04:00
|
|
|
#!/usr/bin/env bash
|
2026-09-18 14:30:20 -04:00
|
|
|
# Print origin paths, distribution status, and served index hash.
|
|
|
|
|
# Used by deploy-web.yaml's always() summary. Never fails the job.
|
2026-09-11 13:40:14 -04:00
|
|
|
set -u
|
2026-09-18 14:30:20 -04:00
|
|
|
DISTRIBUTION_ID="${DISTRIBUTION_ID:-}"
|
|
|
|
|
SITE_URL="${SITE_URL:-}"
|
2026-09-11 13:40:14 -04:00
|
|
|
echo "=== CloudFront live state ==="
|
2026-09-18 14:30:20 -04:00
|
|
|
if [[ -z "${DISTRIBUTION_ID}" ]]; then
|
|
|
|
|
echo "DISTRIBUTION_ID unset"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2026-09-11 13:40:14 -04:00
|
|
|
aws cloudfront get-distribution --id "${DISTRIBUTION_ID}" --output json | python3 -c '
|
|
|
|
|
import json, sys
|
|
|
|
|
payload = json.load(sys.stdin)
|
|
|
|
|
dist = payload.get("Distribution") or {}
|
|
|
|
|
config = dist.get("DistributionConfig") or {}
|
|
|
|
|
print("status:", dist.get("Status"))
|
|
|
|
|
for origin in ((config.get("Origins") or {}).get("Items") or []):
|
|
|
|
|
print("origin %s: origin_path=%r" % (origin.get("Id"), origin.get("OriginPath") or ""))
|
|
|
|
|
'
|
|
|
|
|
echo
|
2026-09-18 14:30:20 -04:00
|
|
|
if [[ -n "${SITE_URL}" ]]; then
|
|
|
|
|
echo -n "served index sha256: "
|
|
|
|
|
curl -fsS --max-time 30 "${SITE_URL%/}/" | python3 -c "import hashlib,sys; print(hashlib.sha256(sys.stdin.buffer.read()).hexdigest())" || echo "unreachable"
|
|
|
|
|
fi
|