refactor: remove dead cloud_exec_long and _*_exec_long functions (#2407)

The cloud_exec_long dispatcher in common.sh and all five cloud-specific
_exec_long implementations (aws, digitalocean, gcp, hetzner, sprite)
were defined but never called by any code in the e2e test suite.

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
A 2026-03-09 19:39:53 -07:00 committed by GitHub
parent 7801c263bb
commit c4ae16849d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 0 additions and 190 deletions

View file

@ -143,45 +143,6 @@ _aws_exec() {
"ubuntu@${_AWS_INSTANCE_IP}" "${cmd}"
}
# ---------------------------------------------------------------------------
# _aws_exec_long APP CMD TIMEOUT
#
# Same as _aws_exec but with ServerAliveInterval keep-alives and the remote
# command wrapped in `timeout` for long-running operations.
# ---------------------------------------------------------------------------
_aws_exec_long() {
local app="$1"
local cmd="$2"
local timeout="${3:-120}"
# Resolve instance IP (cached per app)
if [ "${_AWS_INSTANCE_APP}" != "${app}" ] || [ -z "${_AWS_INSTANCE_IP}" ]; then
if [ -n "${LOG_DIR:-}" ] && [ -f "${LOG_DIR}/${app}.ip" ]; then
_AWS_INSTANCE_IP=$(cat "${LOG_DIR}/${app}.ip")
else
_AWS_INSTANCE_IP=$(aws lightsail get-instance \
--instance-name "${app}" \
--region "${AWS_REGION:-us-east-1}" \
--query 'instance.publicIpAddress' \
--output text 2>/dev/null || true)
fi
_AWS_INSTANCE_APP="${app}"
if [ -z "${_AWS_INSTANCE_IP}" ] || [ "${_AWS_INSTANCE_IP}" = "None" ]; then
log_err "Could not resolve IP for instance ${app}"
return 1
fi
fi
local alive_count=$((timeout / 15 + 1))
# Pipe the command via stdin to avoid interpolating it into the remote
# command string — eliminates shell injection risk from base64 encoding.
printf '%s' "${cmd}" | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=10 -o LogLevel=ERROR -o BatchMode=yes \
-o "ServerAliveInterval=15" -o "ServerAliveCountMax=${alive_count}" \
"ubuntu@${_AWS_INSTANCE_IP}" "timeout ${timeout} bash"
}
# ---------------------------------------------------------------------------
# _aws_teardown APP
#

View file

@ -154,39 +154,6 @@ _digitalocean_exec() {
"root@${ip}" "${cmd}"
}
# ---------------------------------------------------------------------------
# _digitalocean_exec_long APP CMD TIMEOUT
#
# Same as _digitalocean_exec but with ServerAliveInterval for long-running
# commands, and wraps the command in `timeout`.
# ---------------------------------------------------------------------------
_digitalocean_exec_long() {
local app="$1"
local cmd="$2"
local timeout_secs="${3:-120}"
local ip_file="${LOG_DIR:-/tmp}/${app}.ip"
if [ ! -f "${ip_file}" ]; then
log_err "IP file not found: ${ip_file}"
return 1
fi
local ip
ip=$(cat "${ip_file}")
if [ -z "${ip}" ]; then
log_err "Empty IP in ${ip_file}"
return 1
fi
# Pipe the command via stdin to avoid interpolating it into the remote
# command string — eliminates shell injection risk from base64 encoding.
printf '%s' "${cmd}" | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=10 -o LogLevel=ERROR -o BatchMode=yes \
-o "ServerAliveInterval=15" -o "ServerAliveCountMax=$((timeout_secs / 15 + 1))" \
"root@${ip}" "timeout ${timeout_secs} bash"
}
# ---------------------------------------------------------------------------
# _digitalocean_teardown APP
#

View file

@ -150,46 +150,6 @@ _gcp_exec() {
"${ssh_user}@${_GCP_INSTANCE_IP}" "${cmd}"
}
# ---------------------------------------------------------------------------
# _gcp_exec_long APP CMD TIMEOUT
#
# Same as _gcp_exec but with ServerAliveInterval keep-alives and the remote
# command wrapped in `timeout` for long-running operations.
# ---------------------------------------------------------------------------
_gcp_exec_long() {
local app="$1"
local cmd="$2"
local timeout="${3:-120}"
local ssh_user="${GCP_SSH_USER:-$(whoami)}"
# Resolve instance IP (cached per app)
if [ "${_GCP_INSTANCE_APP}" != "${app}" ] || [ -z "${_GCP_INSTANCE_IP}" ]; then
if [ -n "${LOG_DIR:-}" ] && [ -f "${LOG_DIR}/${app}.ip" ]; then
_GCP_INSTANCE_IP=$(cat "${LOG_DIR}/${app}.ip")
else
_GCP_INSTANCE_IP=$(gcloud compute instances describe "${app}" \
--zone="${GCP_ZONE:-us-central1-a}" \
--project="${GCP_PROJECT:-}" \
--format=json 2>/dev/null \
| jq -r '.networkInterfaces[0].accessConfigs[0].natIP // empty' 2>/dev/null || true)
fi
_GCP_INSTANCE_APP="${app}"
if [ -z "${_GCP_INSTANCE_IP}" ]; then
log_err "Could not resolve IP for instance ${app}"
return 1
fi
fi
local alive_count=$((timeout / 15 + 1))
# Pipe the command via stdin to avoid interpolating it into the remote
# command string — eliminates shell injection risk from base64 encoding.
printf '%s' "${cmd}" | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=10 -o LogLevel=ERROR -o BatchMode=yes \
-o "ServerAliveInterval=15" -o "ServerAliveCountMax=${alive_count}" \
"${ssh_user}@${_GCP_INSTANCE_IP}" "timeout ${timeout} bash"
}
# ---------------------------------------------------------------------------
# _gcp_teardown APP
#

View file

@ -128,38 +128,6 @@ _hetzner_exec() {
"root@${ip}" "${cmd}"
}
# ---------------------------------------------------------------------------
# _hetzner_exec_long APP CMD TIMEOUT
#
# Execute a long-running command on the server via SSH with keepalive
# and a remote-side timeout.
# ---------------------------------------------------------------------------
_hetzner_exec_long() {
local app="$1"
local cmd="$2"
local timeout_secs="$3"
local log_dir="${LOG_DIR:-/tmp}"
local ip_file="${log_dir}/${app}.ip"
if [ ! -f "${ip_file}" ]; then
log_err "No IP file found for ${app} at ${ip_file}"
return 1
fi
local ip
ip=$(cat "${ip_file}")
# Pipe the command via stdin to avoid interpolating it into the remote
# command string — eliminates shell injection risk from base64 encoding.
printf '%s' "${cmd}" | ssh -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o LogLevel=ERROR \
-o BatchMode=yes \
-o ConnectTimeout=10 \
-o ServerAliveInterval=15 \
"root@${ip}" "timeout ${timeout_secs} bash"
}
# ---------------------------------------------------------------------------
# _hetzner_teardown APP
#

View file

@ -198,51 +198,6 @@ _sprite_exec() {
rm -f "${_stderr_tmp}"
}
# ---------------------------------------------------------------------------
# _sprite_exec_long APP CMD TIMEOUT
#
# Same as _sprite_exec but wraps the remote command in `timeout` for
# long-running operations. Retries on sprite CLI errors.
# ---------------------------------------------------------------------------
_sprite_exec_long() {
local app="$1"
local cmd="$2"
local timeout="${3:-120}"
# Validate timeout is numeric to prevent command injection
if ! printf '%s' "${timeout}" | grep -qE '^[0-9]+$'; then
printf 'ERROR: timeout must be numeric, got: %s\n' "${timeout}" >&2
return 1
fi
local _attempt=0
local _max=3
local _stderr_tmp="/tmp/sprite-execl-err.$$"
while [ "${_attempt}" -lt "${_max}" ]; do
_sprite_fix_config
# Pipe the command via stdin to avoid interpolating it into the remote
# command string — eliminates shell injection risk from base64 encoding.
# shellcheck disable=SC2046
printf '%s' "${cmd}" | sprite $(_sprite_org_flags) exec -s "${app}" -- timeout "${timeout}" bash 2>"${_stderr_tmp}"
local _rc=$?
if [ "${_rc}" -eq 0 ]; then
rm -f "${_stderr_tmp}"
return 0
fi
if grep -qiE 'config|migrate|initialize|connection refused' "${_stderr_tmp}" 2>/dev/null; then
_attempt=$((_attempt + 1))
if [ "${_attempt}" -lt "${_max}" ]; then
sleep 2
continue
fi
fi
rm -f "${_stderr_tmp}"
return "${_rc}"
done
rm -f "${_stderr_tmp}"
}
# ---------------------------------------------------------------------------
# _sprite_teardown APP
#

View file

@ -86,7 +86,6 @@ cloud_validate_env() { "_${ACTIVE_CLOUD}_validate_env" "$@"; }
cloud_headless_env() { "_${ACTIVE_CLOUD}_headless_env" "$@"; }
cloud_provision_verify() { "_${ACTIVE_CLOUD}_provision_verify" "$@"; }
cloud_exec() { "_${ACTIVE_CLOUD}_exec" "$@"; }
cloud_exec_long() { "_${ACTIVE_CLOUD}_exec_long" "$@"; }
cloud_teardown() { "_${ACTIVE_CLOUD}_teardown" "$@"; }
cloud_cleanup_stale() { "_${ACTIVE_CLOUD}_cleanup_stale" "$@"; }