fix(cicd): docker push 加重试循环(8次),应对跨地域网络断流
devops→middleware push 大 blob 反复 use of closed network connection。 docker push 支持断点续传,重试时已传层跳过,多次后最终传完。
This commit is contained in:
parent
7b0f74ebb8
commit
efa9f1d489
13
Jenkinsfile
vendored
13
Jenkinsfile
vendored
@ -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
|
||||
'''
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user