fix(scripts): read the /login page before matching it
`curl | grep -q` fails under pipefail when grep stops early.
Jason Schwarzenberger authored 1 parent ff5bbbccommit 4bc699234c5880d2708ee4a4fbdf10a91195ed32Browse files
- CI / Typecheck and bundleFailed
- CI / Unit tests (1/2)Failed
- CI / Unit tests (2/2)Failed
- End-to-end / End-to-end (agent reviews, tasks, Today)Failed
- End-to-end / End-to-end (git, PRs, Actions)Failed
- End-to-end / End-to-end (large pushes)success
- End-to-end / End-to-end (passkeys, registry, email)Failed
- End-to-end / End-to-end (real histories)success
- End-to-end / End-to-end (runner Docker)success
- End-to-end / End-to-end (security)Failed
2 files changed+6−1
modifiedHOMEFLARE.md+2−0View file
| @@ -8,6 +8,8 @@ | ||
| 8 | 8 | with Cloudflare's API and registry as the defaults. |
| 9 | 9 | - The Homeflare deploy described below, skipping the steps that need Cloudflare |
| 10 | 10 | itself. |
| 11 | +- `scripts/setup.sh` reading the `/login` page before matching it: `curl | grep -q` | |
| 12 | + fails under `pipefail` when grep stops early. | |
| 11 | 13 | |
| 12 | 14 | Rebase onto upstream when it moves: |
| 13 | 15 |
modifiedscripts/setup.sh+4−1View file
| @@ -258,7 +258,10 @@ | ||
| 258 | 258 | [[ "$code" == 200 ]] || die "https://$DIFFINERY_DOMAIN/healthz did not return 200 (last: ${code:-no answer}). Check that $DIFFINERY_DOMAIN resolves to the host serving $CF_API and that the Worker started." |
| 259 | 259 | fi |
| 260 | 260 | info "/healthz -> 200" |
| 261 | -curl -sS "https://$DIFFINERY_DOMAIN/login" | grep -q "Sign in with a passkey" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc" | |
| 261 | +# Read the whole page before matching: `curl | grep -q` fails under pipefail when grep stops | |
| 262 | +# early and curl can't finish writing (curl: (23) Failed writing body). | |
| 263 | +LOGIN_PAGE="$(curl -sS "https://$DIFFINERY_DOMAIN/login" || true)" | |
| 264 | +grep -q "Sign in with a passkey" <<<"$LOGIN_PAGE" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc" | |
| 262 | 265 | info "/login serves the passkey sign-in page" |
| 263 | 266 | loc="$(curl -sS -o /dev/null -w '%{http_code} %{redirect_url}' "https://$DIFFINERY_DOMAIN/auth/access" || true)" |
| 264 | 267 | if ((ON_CLOUDFLARE == 0)); then |