CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
verify-deploy.sh
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 6d2b36e | 1 | #!/usr/bin/env bash |
| 2 | # Post-deploy smoke verifier. Runs the DEPLOY_CHECKLIST.md post-deploy | |
| 3 | # smoke tests as a single command. Exits non-zero on any failure so it | |
| 4 | # can be dropped into CI or a post-deploy hook. | |
| 5 | # | |
| 6 | # Usage: | |
| 7 | # bash scripts/verify-deploy.sh # defaults to https://gluecron.com | |
| 8 | # bash scripts/verify-deploy.sh https://staging.example # override base URL | |
| 9 | # BASE_URL=https://gluecron.com bash scripts/verify-deploy.sh | |
| 10 | ||
| 11 | set -uo pipefail | |
| 12 | ||
| 13 | BASE_URL="${1:-${BASE_URL:-https://gluecron.com}}" | |
| 14 | BASE_URL="${BASE_URL%/}" | |
| 15 | ||
| 16 | fail=0 | |
| 17 | ||
| 18 | check() { | |
| 19 | local label="$1" | |
| 20 | local url="$2" | |
| 21 | local expect_status="${3:-200}" | |
| 22 | local match="${4:-}" | |
| 23 | ||
| 24 | local tmp status body | |
| 25 | tmp="$(mktemp)" | |
| 26 | status="$(curl -sS -o "$tmp" -w '%{http_code}' --max-time 10 "$url" || echo 000)" | |
| 27 | body="$(cat "$tmp")" | |
| 28 | rm -f "$tmp" | |
| 29 | ||
| 30 | if [[ "$status" != "$expect_status" ]]; then | |
| 31 | printf ' \033[31mFAIL\033[0m %-32s %s (got %s, want %s)\n' \ | |
| 32 | "$label" "$url" "$status" "$expect_status" | |
| 33 | fail=$((fail + 1)) | |
| 34 | return | |
| 35 | fi | |
| 36 | ||
| 37 | if [[ -n "$match" && "$body" != *"$match"* ]]; then | |
| 38 | printf ' \033[31mFAIL\033[0m %-32s %s (body missing %q)\n' \ | |
| 39 | "$label" "$url" "$match" | |
| 40 | fail=$((fail + 1)) | |
| 41 | return | |
| 42 | fi | |
| 43 | ||
| 44 | printf ' \033[32mOK\033[0m %-32s %s (%s)\n' "$label" "$url" "$status" | |
| 45 | } | |
| 46 | ||
| 47 | echo "Verifying $BASE_URL ..." | |
| 48 | ||
| 49 | check "healthz" "$BASE_URL/healthz" 200 | |
| 50 | check "readyz" "$BASE_URL/readyz" 200 | |
| 51 | check "status (html)" "$BASE_URL/status" 200 "status" | |
| 52 | check "status.svg" "$BASE_URL/status.svg" 200 "<svg" | |
| 53 | check "metrics" "$BASE_URL/metrics" 200 "# HELP" | |
| 54 | check "landing (/)" "$BASE_URL/" 200 | |
| 55 | ||
| 56 | # www alias — only runs when the base URL has no www and is HTTPS | |
| 57 | if [[ "$BASE_URL" =~ ^https://[^/]+$ ]] && [[ ! "$BASE_URL" =~ https://www\. ]]; then | |
| 58 | www_url="${BASE_URL/https:\/\//https:\/\/www.}" | |
| 59 | check "www alias /healthz" "$www_url/healthz" 200 | |
| 60 | fi | |
| 61 | ||
| 62 | if [[ "$fail" -eq 0 ]]; then | |
| 63 | printf '\n\033[32mAll checks passed.\033[0m\n' | |
| 64 | exit 0 | |
| 65 | fi | |
| 66 | ||
| 67 | printf '\n\033[31m%d check(s) failed.\033[0m\n' "$fail" | |
| 68 | exit 1 |