#!/usr/bin/env bash # Print pointer body, origin paths, distribution status, and served index hash. # Used by deploy.yml's always() summary. Never fails the job on a missing pointer. set -u DISTRIBUTION_ID="${DISTRIBUTION_ID:-E2CWLM1AFB964P}" SITE_BUCKET="${SITE_BUCKET:-seahaven-shoc-frontend-dev}" SITE_URL="${SITE_URL:-https://dev.seahaven.com}" echo "=== CloudFront live state ===" echo "pointer:" aws s3 cp "s3://${SITE_BUCKET}/.release/current" - --only-show-errors 2>/dev/null || echo "(missing)" echo 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 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"