fix(docker): bound smoke installer curl with connect timeout (#109698)

* fix(docker): bound smoke installer curl with connect timeout

Add --connect-timeout 30 and --max-time 300 to the direct installer
one-liner curl in the smoke test runner. The run_installer_for_package_spec
function is already bounded by timeout(1), but this direct invocation had
no curl-level or wrapper-level timeout.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(docker): wrap complete installer pipeline in timeout, not just curl

Replace the stand-alone curl timeout flags on the direct installer one-liner
with a timeout(1) wrapper around the entire curl|bash pipeline, matching the
run_installer_for_package_spec pattern. This bounds the complete pipeline
(download + install) rather than just the network transfer.

The curl-level --connect-timeout 30 and --max-time 300 are retained as
defence-in-depth inside the timeout wrapper.

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: centralize installer smoke pipeline bounds

Co-authored-by: LZY3538 <liu.zhenye@xydigit.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
LZY3538
2026-07-17 17:20:40 +08:00
committed by GitHub
parent 708d2020d8
commit 45f36640dc
2 changed files with 198 additions and 15 deletions
+24 -13
View File
@@ -252,13 +252,16 @@ resolve_update_baseline_version() {
UPDATE_BASELINE_VERSION="$resolved_version"
}
run_installer_for_package_spec() {
run_installer_pipeline() {
local install_url="$1"
local package_spec="$2"
shift
# Keep both pipeline processes under one timeout, and preserve download failures
# even when the installer shell consumes a partial response and exits cleanly.
timeout --kill-after=30s "${INSTALL_COMMAND_TIMEOUT}s" \
bash -c "curl -fsSL \"\$1\" | bash -s -- --install-method npm --version \"\$2\" --no-prompt --no-onboard" \
_ "$install_url" "$package_spec"
bash -o pipefail -c \
'curl -fsSL --connect-timeout 30 --max-time 300 -- "$1" | bash -s -- "${@:2}"' \
_ "$install_url" "$@"
}
run_install_smoke() {
@@ -267,7 +270,12 @@ run_install_smoke() {
echo "==> Run official installer one-liner for latest release tarball"
OPENCLAW_NO_ONBOARD=1 OPENCLAW_NO_PROMPT=1 \
run_with_heartbeat "installer latest release tarball" \
run_installer_for_package_spec "$INSTALL_URL" "$FRESH_TAG_URL"
run_installer_pipeline \
"$INSTALL_URL" \
--install-method npm \
--version "$FRESH_TAG_URL" \
--no-prompt \
--no-onboard
print_install_audit "fresh install"
echo "==> Verify installed version"
@@ -335,7 +343,7 @@ NODE
fi
echo "==> Run official installer one-liner"
curl -fsSL "$INSTALL_URL" | bash -s -- --no-prompt
run_installer_pipeline "$INSTALL_URL" --no-prompt
echo "==> Verify installed version"
if [[ -n "${OPENCLAW_INSTALL_LATEST_OUT:-}" ]]; then
@@ -594,13 +602,16 @@ run_freshness_smoke() {
fi
echo "==> Run installer with same npm freshness policy"
env \
HOME="$policy_home" \
NPM_CONFIG_USERCONFIG="${policy_home}/.npmrc" \
OPENCLAW_NO_ONBOARD=1 \
OPENCLAW_NO_PROMPT=1 \
bash -c 'curl -fsSL "$1" | bash -s -- --install-method npm --version "$2" --no-prompt --no-onboard' \
_ "$INSTALL_URL" "$FRESHNESS_VERSION"
HOME="$policy_home" \
NPM_CONFIG_USERCONFIG="${policy_home}/.npmrc" \
OPENCLAW_NO_ONBOARD=1 \
OPENCLAW_NO_PROMPT=1 \
run_installer_pipeline \
"$INSTALL_URL" \
--install-method npm \
--version "$FRESHNESS_VERSION" \
--no-prompt \
--no-onboard
echo "==> Verify installed version"
print_install_audit "freshness install"