fix: Deploy to K3s 添加 3 次重试,防止内网抖动导致构建失败
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 6s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
zyc 2026-04-04 14:35:31 +08:00
parent 05097d58f9
commit 1ff985d64f

View File

@ -130,8 +130,10 @@ jobs:
--from-literal=ALIYUN_SMS_ACCESS_SECRET='${{ secrets.ALIYUN_SMS_ACCESS_SECRET }}' \ --from-literal=ALIYUN_SMS_ACCESS_SECRET='${{ secrets.ALIYUN_SMS_ACCESS_SECRET }}' \
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
# Apply manifests # Apply manifests (with retry for transient network issues)
set -o pipefail set -o pipefail
for attempt in 1 2 3; do
echo "Deploy attempt $attempt/3..."
{ {
kubectl apply -f k8s/backend-deployment.yaml kubectl apply -f k8s/backend-deployment.yaml
kubectl apply -f k8s/celery-deployment.yaml kubectl apply -f k8s/celery-deployment.yaml
@ -144,7 +146,10 @@ jobs:
kubectl rollout restart deployment/video-backend kubectl rollout restart deployment/video-backend
kubectl rollout restart deployment/celery-worker kubectl rollout restart deployment/celery-worker
kubectl rollout restart deployment/video-web kubectl rollout restart deployment/video-web
} 2>&1 | tee /tmp/deploy.log } 2>&1 | tee /tmp/deploy.log && break
echo "Attempt $attempt failed, retrying in 10s..."
sleep 10
done
# ===== Log Center: failure reporting ===== # ===== Log Center: failure reporting =====
- name: Report failure to Log Center - name: Report failure to Log Center