fix(ci): retry apk build after clearing corrupted Gradle cache
Handle sporadic Gradle wrapper zip corruption on Jenkins by retrying build once after removing ~/.gradle/wrapper/dists. Made-with: Cursor
This commit is contained in:
parent
9fbefc4438
commit
55d035cb9c
|
|
@ -159,6 +159,8 @@ pipeline {
|
|||
|
||||
echo " - 开始构建 APK 参数: \$EXTRA_ARGS"
|
||||
echo " - 开始执行 flutter build apk(构建期间每30秒输出一次心跳)..."
|
||||
|
||||
run_build_with_heartbeat() {
|
||||
(fvm flutter build apk --release \$EXTRA_ARGS) &
|
||||
BUILD_PID=\$!
|
||||
while kill -0 \$BUILD_PID 2>/dev/null; do
|
||||
|
|
@ -166,6 +168,14 @@ pipeline {
|
|||
sleep 30
|
||||
done
|
||||
wait \$BUILD_PID
|
||||
return \$?
|
||||
}
|
||||
|
||||
if ! run_build_with_heartbeat; then
|
||||
echo " ⚠️ 首次构建失败,尝试清理 Gradle wrapper 缓存后重试一次..."
|
||||
rm -rf "\$HOME/.gradle/wrapper/dists"
|
||||
run_build_with_heartbeat
|
||||
fi
|
||||
"""
|
||||
echo " ✅ ${currentApp} Android APK 构建完成"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue