Revert "fix(hooks): treat Gradle distribution download failure as infra skip"

This reverts commit a2ee1880a6.
This commit is contained in:
Claude
2026-07-17 00:40:27 +00:00
parent bc34a4cf59
commit bd6635b311
+3 -7
View File
@@ -64,13 +64,9 @@ before="$(git diff HEAD -- '*.kt' '*.kts' 2>/dev/null | sha1sum)"
log="$(mktemp /tmp/spotless-gate.XXXXXX.log)"
if ! ./gradlew spotlessApply >"$log" 2>&1; then
# Distinguish a formatting failure (block) from Gradle being unable to RUN —
# e.g. deps can't resolve, or the wrapper can't even download the Gradle
# distribution, in a restricted sandbox. An infra failure must not strand the
# agent; warn and let CI's spotlessCheck be the backstop. The distribution
# patterns (the `gradle-<ver>-bin.zip` URL, the Java download exception, and a
# proxy 40x on that fetch) only appear when `./gradlew` failed *before* running
# any task, so they can't mask a real formatting/compile error.
if grep -qiE "could not resolve|could not (get|download)|handshake|connect timed out|no address|unable to (find|resolve) host|read timed out|server returned http response code|gradle-[0-9][0-9.]*-(bin|all)\.zip|could not install gradle" "$log"; then
# e.g. deps can't resolve in a restricted sandbox. An infra failure must not
# strand the agent; warn and let CI's spotlessCheck be the backstop.
if grep -qiE "could not resolve|could not (get|download)|handshake|connect timed out|no address|unable to (find|resolve) host|read timed out" "$log"; then
echo "WARN: could not run spotlessApply (Gradle infra/network failure), skipping the formatting gate." >&2
echo " CI's spotlessCheck still enforces formatting on the PR." >&2
rm -f "$log"