Files
Pulse/scripts/go-mod-download.sh
pulse-triage[bot] 2896922ec7 Recover bounded Go proxy timeouts before hosted qualification builds
The hosted qualification compiler stopped on a Go proxy TLS handshake timeout before its first subject build. Prepare modules through the existing bounded transport-only helper, admitting only the observed official-proxy timeout in addition to the existing HTTP2 stream signature. Keep refusals, certificate and integrity failures fatal and reject module-manifest drift before building. Compilation, attestation and uploads are never retried by this repair.

Exercise the real hosted build block and Docker consumer offline for recovery, exhaustion, identity, manifest and fatal build failures. Include the dependency helper in both active qualification source manifests.

Contract-Neutral: Dependency acquisition repair only; signed artifact trust, qualification semantics and product runtime behavior are unchanged.
Change-source: pulse-maintainer
2026-11-09 06:45:16 +00:00

46 lines
1.6 KiB
Bash

#!/bin/sh
# Recover only the observed HTTP/2 proxy stream failure or official-proxy TLS
# handshake timeout, never an access, certificate, checksum, manifest or unknown
# error. Keep the same Go proxy and sumdb.
set -eu
if [ "$#" -ne 0 ]; then
echo 'Usage: go-mod-download.sh (no arguments)' >&2
exit 2
fi
log=$(mktemp)
trap 'rm "$log"' 0
trap 'exit 130' INT
trap 'exit 143' TERM
attempt=1
while :; do
# Both Alpine BusyBox and GNU timeout support this fixed invocation.
# TERM at 180 seconds has a five-second KILL backstop. A timeout
# is a terminal failure, not a reason to retry.
if timeout -k 5 180 go mod download >"$log" 2>&1; then
cat "$log"
exit 0
else
status=$?
fi
cat "$log" >&2
if [ "$status" -ne 1 ] || [ "$attempt" -eq 3 ]; then
exit "$status"
fi
# Every diagnostic must be a specific transport failure. A refusal or
# integrity error alongside it takes precedence and stops this attempt.
if ! LC_ALL=C awk '
/^go: [^[:space:]]+@[^[:space:]]+: read "https:\/\/[^"[:space:]]+": stream error: stream ID [0-9]+; INTERNAL_ERROR; received from peer$/ { seen = 1; next }
/^go: [^[:space:]]+@[^[:space:]]+: Get "https:\/\/proxy\.golang\.org\/[^"[:space:]]+": net\/http: TLS handshake timeout$/ { seen = 1; next }
{ unknown = 1 }
END { exit !(seen && !unknown) }
' "$log"; then
exit "$status"
fi
echo "Go module proxy transport failed; retrying the same download ($attempt/3)." >&2
sleep "$((attempt * 2))"
attempt=$((attempt + 1))
done