fix(cicd): docker push 加重试循环(8次),应对跨地域网络断流

与 api 同款修复:push 大 blob 断流时重试,断点续传。
This commit is contained in:
xiangning 2026-07-17 14:16:27 +08:00
parent a00f63d7be
commit 706b03f84e

13
Jenkinsfile vendored
View File

@ -35,8 +35,17 @@ pipeline {
withCredentials([usernamePassword(credentialsId: "harbor-credentials", usernameVariable: "HUSER", passwordVariable: "HPASS")]) {
sh '''
echo $HPASS | docker login $HARBOR -u $HUSER --password-stdin
docker push $IMAGE:$TAG
docker push $IMAGE:latest
# 跨地域 push 大 blob 易断流,重试利用断点续传
for i in 1 2 3 4 5 6 7 8; do
docker push $IMAGE:$TAG && break
echo "push $IMAGE:$TAG 第 $i 次中断,3秒后重试(断点续传)..."
sleep 3
done
for i in 1 2 3 4 5 6 7 8; do
docker push $IMAGE:latest && break
echo "push $IMAGE:latest 第 $i 次中断,3秒后重试..."
sleep 3
done
docker logout $HARBOR
'''
}