Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions apps/web/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ spec:
# their search index are served, an unknown path answers the site's own
# 404 page with a 404 status, and one under /fr/ the French 404 page
# (lang="fr") with a 404 status (the Worker). `-L` follows the directory
# redirect (/products → /products/). Each response is buffered before grep
# so an early match cannot SIGPIPE curl.
smokeCommand: "html=$(curl -sfL \"${DEPLOYED_URL}/\") && echo \"${html}\" | grep -q 'hreflang=\"fr\"' && products=$(curl -sfL \"${DEPLOYED_URL}/products\") && echo \"${products}\" | grep -q '/products/item-a765/' && curl -sfL -o /dev/null \"${DEPLOYED_URL}/welcome-to-docs/\" && curl -sf -o /dev/null \"${DEPLOYED_URL}/pagefind/pagefind.js\" && test \"$(curl -s -o /dev/null -w '%{http_code}' \"${DEPLOYED_URL}/no-such-page\")\" = 404 && test \"$(curl -s -o /dev/null -w '%{http_code}' \"${DEPLOYED_URL}/fr/no-such-page\")\" = 404 && fr=$(curl -s \"${DEPLOYED_URL}/fr/no-such-page\") && echo \"${fr}\" | grep -q '<html lang=\"fr\"'"
# redirect (/products → /products/). Each response is buffered and handed
# to grep as a here-string, never piped: grep -q exits at its first match,
# and under the step's pipefail a writer killed by SIGPIPE (the home page is
# over 64 KiB) failed a check whose text was found.
smokeCommand: "html=$(curl -sfL \"${DEPLOYED_URL}/\") && grep -q 'hreflang=\"fr\"' <<< \"${html}\" && products=$(curl -sfL \"${DEPLOYED_URL}/products\") && grep -q '/products/item-a765/' <<< \"${products}\" && curl -sfL -o /dev/null \"${DEPLOYED_URL}/welcome-to-docs/\" && curl -sf -o /dev/null \"${DEPLOYED_URL}/pagefind/pagefind.js\" && test \"$(curl -s -o /dev/null -w '%{http_code}' \"${DEPLOYED_URL}/no-such-page\")\" = 404 && test \"$(curl -s -o /dev/null -w '%{http_code}' \"${DEPLOYED_URL}/fr/no-such-page\")\" = 404 && fr=$(curl -s \"${DEPLOYED_URL}/fr/no-such-page\") && grep -q '<html lang=\"fr\"' <<< \"${fr}\""
labels:
team: platform
layer: delivery
Expand Down
2 changes: 1 addition & 1 deletion apps/web/docs/runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ After a deploy the lane runs this smoke against the environment it
deployed (`ORUN_ENVIRONMENT`); `DEPLOYED_URL` overrides the URL:

```bash
html=$(curl -sfL "${DEPLOYED_URL}/") && echo "${html}" | grep -q 'hreflang="fr"' && products=$(curl -sfL "${DEPLOYED_URL}/products") && echo "${products}" | grep -q '/products/item-a765/' && curl -sfL -o /dev/null "${DEPLOYED_URL}/welcome-to-docs/" && curl -sf -o /dev/null "${DEPLOYED_URL}/pagefind/pagefind.js" && test "$(curl -s -o /dev/null -w '%{http_code}' "${DEPLOYED_URL}/no-such-page")" = 404 && test "$(curl -s -o /dev/null -w '%{http_code}' "${DEPLOYED_URL}/fr/no-such-page")" = 404 && fr=$(curl -s "${DEPLOYED_URL}/fr/no-such-page") && echo "${fr}" | grep -q '<html lang="fr"'
html=$(curl -sfL "${DEPLOYED_URL}/") && grep -q 'hreflang="fr"' <<< "${html}" && products=$(curl -sfL "${DEPLOYED_URL}/products") && grep -q '/products/item-a765/' <<< "${products}" && curl -sfL -o /dev/null "${DEPLOYED_URL}/welcome-to-docs/" && curl -sf -o /dev/null "${DEPLOYED_URL}/pagefind/pagefind.js" && test "$(curl -s -o /dev/null -w '%{http_code}' "${DEPLOYED_URL}/no-such-page")" = 404 && test "$(curl -s -o /dev/null -w '%{http_code}' "${DEPLOYED_URL}/fr/no-such-page")" = 404 && fr=$(curl -s "${DEPLOYED_URL}/fr/no-such-page") && grep -q '<html lang="fr"' <<< "${fr}"
```

## Rollback
Expand Down
2 changes: 2 additions & 0 deletions testing/placement.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ for (comp, env), j in jobs.items():
or "/welcome-to-docs/" not in smoke or "/pagefind/pagefind.js" not in smoke
or "/fr/no-such-page" not in smoke or "<html lang=" not in smoke):
bad(f"{comp}@{env}'s smoke is not the site's")
if "| grep -q" in smoke:
bad(f"{comp}@{env}'s smoke pipes into grep -q — under pipefail a page over 64 KiB fails it with SIGPIPE; use a here-string")
if f'export WORKERS_DEV_SUBDOMAIN="{sub}"' not in steps.get("smoke", ""):
bad(f"{comp}@{env}'s smoke probes another workers.dev subdomain")
refs = {r["asEnv"]: r["ref"] for r in j.get("secretRefs") or []}
Expand Down
Loading