fix: Deploy to K3s 添加 3 次重试,防止内网抖动导致构建失败
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 6s
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:
parent
05097d58f9
commit
1ff985d64f
@ -130,21 +130,26 @@ 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
|
||||||
kubectl apply -f k8s/backend-deployment.yaml
|
echo "Deploy attempt $attempt/3..."
|
||||||
kubectl apply -f k8s/celery-deployment.yaml
|
{
|
||||||
kubectl apply -f k8s/web-deployment.yaml
|
kubectl apply -f k8s/backend-deployment.yaml
|
||||||
kubectl apply -f k8s/ingress.yaml
|
kubectl apply -f k8s/celery-deployment.yaml
|
||||||
|
kubectl apply -f k8s/web-deployment.yaml
|
||||||
|
kubectl apply -f k8s/ingress.yaml
|
||||||
|
|
||||||
# Preserve real client IP
|
# Preserve real client IP
|
||||||
kubectl patch svc traefik -n kube-system -p '{"spec":{"externalTrafficPolicy":"Local"}}' 2>/dev/null || true
|
kubectl patch svc traefik -n kube-system -p '{"spec":{"externalTrafficPolicy":"Local"}}' 2>/dev/null || true
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user