chennaji9 opened a new pull request, #6803: URL: https://github.com/apache/rocketmq-dashboard/pull/6803
### Which Issue(s) This PR Fixes None — small self-contained fix found by inspection (no issue tracked). ### Brief Description `deploy/rocketmq/build.sh` picks the package mirrors from a geolocation probe: ```sh country=$(curl -s --max-time 3 'http://ip-api.com/line?fields=countryCode' 2>/dev/null || true) if [ -z "$country" ]; then ... google-reachability fallback ... fi ``` The curl has no `-f`, and ip-api answers rate limiting with **HTTP 429 plus a non-empty body** (`HTTP 429: too many requests`). The script took that body as the country code: the empty-check passed, the fallback never ran, and `"$country" = "CN"` was false — so on exactly the network that needs the Aliyun mirrors, a rate-limited probe flipped the build to the default (unreachable or very slow) sources. The same holds for any 5xx body the service returns. The probe now uses `curl -sf` (an HTTP failure produces no body and a non-zero exit, so the fallback runs), and whatever comes back is validated as a two-letter uppercase country code (CR/LF/whitespace trimmed) — anything else is treated as a probe failure and goes to the existing google fallback rather than being trusted as a country. ### How Did You Test This Change? Replayed `build.sh` end to end with a semantics-faithful fake `curl` on `PATH` (it models `-f` behaviour and the 429 body) and a fake `docker` that records `USE_CN_MIRROR`; no network, no containers: | scenario | old | new | |---|---|---| | ip-api returns 429 body, google unreachable (the CN-network case) | `USE_CN_MIRROR=false` — the bug | `true` via fallback | | valid `CN` | `true` | `true` | | valid `US` with trailing CR | `false` | `false` | | probe dead, google reachable | `false` | `false` | | probe dead, google unreachable | `true` | `true` | `sh -n` clean; `shellcheck` reports no findings. (The repo has no shell test harness; verification is the replay matrix above, per the earlier deploy PRs.) ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`fix:`) - [x] Tests added or updated for non-trivial changes (n/a — behaviour verified by the five-scenario replay; no harness exists for deploy scripts) - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (n/a — no UI change) - [x] Architecture constraints stay green (n/a — demo build script only) - [x] New source files carry the ASF license header (n/a — no new source file) - [x] Documentation touched where behaviour changed (n/a — the fallback's documented intent now holds on HTTP errors too) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
