All checks were successful
Build + push backend image (Forgejo registry) / build-push (push) Successful in 1m23s
Build + push frontend image (Forgejo registry) / build-push (push) Successful in 1m22s
Sync infra to hosts / sync-beta (push) Successful in 9s
Sync infra to hosts / sync-prod (push) Successful in 8s
secrets-guard / encrypted (push) Successful in 6s
shell-lint / shellcheck (push) Successful in 9s
Deploy backend to beta VPS / deploy (push) Successful in 2m4s
Deploy frontend to beta VPS / deploy (push) Successful in 1m8s
Adds .forgejo/workflows/shell-lint.yml (pinned shellcheck v0.11.0 + sha256, -x, default severity, fail on any finding, not path-filtered) and drives all 26 scripts to zero findings. Two defects shellcheck cannot see: render-secrets.sh left DECRYPTED vault contents in /tmp whenever a sops decrypt failed -- the caller's set -e aborted the function before either cleanup ran. Now removed on every exit path, with `|| return 1` on both sops calls so a decrypt failure can never write a partial /etc/thermograph.env regardless of the caller's shell options. Explicitly not a `trap ... RETURN`: such a trap set in a sourced function persists into the caller's shell and re-fires when the caller's next `.`/source completes, where the function-local tmp is unset -- fatal and silent under deploy.sh's set -u. The file now records that reasoning. autoscale.sh ran `set -eu` without pipefail while piping docker stats into awk, so a failed left side was swallowed and the loop autoscaled on empty input. Promoted to pipefail with a missed sample treated as a skip; verified busybox ash in docker:27-cli supports it. Also: capture-fixtures.sh's `jq . || cat` ran cat after jq had consumed stdin, silently writing truncated fixtures; deploy.sh/deploy-stack.sh `# shellcheck source=` paths corrected for the monorepo layout.
31 lines
1.3 KiB
Bash
Executable file
31 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Refresh the committed unit-test fixtures (tests/fixtures/*.json) by capturing the
|
|
# real payloads a live backend returns for a known city. Run when the backend's content
|
|
# contract changes. Brings the backend harness up, saves each api_client endpoint's
|
|
# response, and tears it down. Requires jq for pretty output.
|
|
#
|
|
# scripts/capture-fixtures.sh
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
SLUG="${FIXTURE_CITY:-london-england-gb}" # GB city -> Celsius rendering
|
|
MONTH="${FIXTURE_MONTH:-july}"
|
|
OUT=tests/fixtures
|
|
mkdir -p "$OUT"
|
|
|
|
BASE=$(scripts/backend-for-tests.sh up)
|
|
trap 'scripts/backend-for-tests.sh down >/dev/null 2>&1 || true' EXIT
|
|
|
|
fetch() { # <endpoint-path> <fixture-name>
|
|
echo "==> $2.json <- $1"
|
|
curl -fsS "$BASE/$1" --max-time 40 | { if command -v jq >/dev/null; then jq .; else cat; fi; } > "$OUT/$2.json"
|
|
}
|
|
|
|
fetch "api/v2/content/home" home
|
|
fetch "api/v2/content/sitemap" sitemap
|
|
fetch "api/v2/content/hub" hub
|
|
fetch "api/v2/content/city/$SLUG" city
|
|
fetch "api/v2/content/city/$SLUG/month/$MONTH" month
|
|
fetch "api/v2/content/city/$SLUG/records" records
|
|
|
|
echo "==> captured $(find "$OUT" -maxdepth 1 -name '*.json' | wc -l) fixtures for $SLUG into $OUT/"
|