You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo"❌ Jekyll build failed with exit code: $build_result"
79
-
return$build_result
80
-
else
73
+
# Capture Jekyll output for error analysis
74
+
if bundle exec jekyll build --trace --config _config_base.yml,$config2>&1| tee "$build_log";then
75
+
echo"⏰ Build end: $(date)"
81
76
echo"✅ Jekyll build completed successfully"
82
77
return 0
78
+
else
79
+
local exit_code=$?
80
+
echo"⏰ Build end: $(date)"
81
+
echo"❌ Jekyll build failed with exit code: $exit_code"
82
+
83
+
# Analyze build log for error classification
84
+
echo"🔍 Analyzing build errors for retry eligibility..."
85
+
86
+
# Check for transient network errors that should be retried
87
+
if grep -qiE "(temporary failure in name resolution|connection refused|connection reset|SSL_connect|certificate verify failed|execution expired|timeout|network is unreachable|failed to open tcp connection|socketerror)""$build_log";then
88
+
echo"🌐 Transient network error detected - eligible for retry"
89
+
echo"📋 Network error details:"
90
+
grep -iE "(temporary failure in name resolution|connection refused|connection reset|SSL_connect|certificate verify failed|execution expired|timeout|network is unreachable|failed to open tcp connection|socketerror)""$build_log"| head -3
91
+
return 2 # Retryable error
92
+
fi
93
+
94
+
# Check for permanent errors that should NOT be retried
95
+
if grep -qiE "(liquid.*syntax error|liquid error|argumenterror|no such file or directory|undefined method|unknown tag|was not properly terminated|missing file)""$build_log";then
96
+
echo"🚫 Permanent build error detected - not retrying"
97
+
echo"📋 Error details:"
98
+
grep -iE "(liquid.*syntax error|liquid error|argumenterror|no such file or directory|undefined method|unknown tag|was not properly terminated|missing file)""$build_log"| head -3
99
+
return 1 # Non-retryable error
100
+
fi
101
+
102
+
# If we can't classify the error, treat it as non-retryable to be safe
103
+
echo"❓ Unclassified build error - treating as permanent (not retrying)"
104
+
echo"📋 Last few lines of build log:"
105
+
tail -5 "$build_log"
106
+
return 1 # Non-retryable error by default
83
107
fi
84
108
}
85
109
@@ -91,18 +115,30 @@ function build_with_retries {
91
115
log_attempt $attempt$MAX_RETRIES
92
116
ATTEMPT_COUNT=$attempt
93
117
94
-
if build_with_monitoring "$config";then
118
+
build_with_monitoring "$config"
119
+
local result=$?
120
+
121
+
if [[ $result== 0 ]];then
95
122
echo"✅ Build succeeded on attempt ${attempt}/${MAX_RETRIES}"
96
123
success=true
97
124
break
98
-
else
99
-
echo"❌ Build failed on attempt ${attempt}/${MAX_RETRIES}"
125
+
elif [[ $result== 1 ]];then
126
+
echo"❌ Build failed on attempt ${attempt}/${MAX_RETRIES} with permanent error"
127
+
echo"🚫 Permanent error detected - failing immediately (no retry)"
128
+
break# Don't retry permanent errors
129
+
elif [[ $result== 2 ]];then
130
+
echo"❌ Build failed on attempt ${attempt}/${MAX_RETRIES} with transient error"
100
131
if [[ $attempt-lt$MAX_RETRIES ]];then
101
132
local next_delay=$((BASE_RETRY_DELAY * (1<< (attempt -1))))
102
-
echo"🔄 Will retry in ${next_delay} seconds (exponential backoff)..."
133
+
echo"🔄 Transient error - will retry in ${next_delay} seconds (exponential backoff)..."
103
134
else
104
-
echo"💀 All retry attempts exhausted"
135
+
echo"💀 All retry attempts exhausted for transient error"
105
136
fi
137
+
else
138
+
# Fallback for unexpected return codes
139
+
echo"❌ Build failed on attempt ${attempt}/${MAX_RETRIES} with unexpected error code: $result"
140
+
echo"⚠️ Treating as permanent error - not retrying"
0 commit comments