Add retry for docker push (#6427)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-08-28 23:38:19 +07:00 committed by GitHub
parent 6e47c6d378
commit 084bce83e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 4 deletions

View File

@ -11,11 +11,23 @@ then
version="${a[0]}.${a[1]}.${c}-staging" version="${a[0]}.${a[1]}.${c}-staging"
echo "Tagging stating $1 with version ${version}" echo "Tagging stating $1 with version ${version}"
docker tag "$1:$rev_version" "$1:$version" docker tag "$1:$rev_version" "$1:$version"
docker push "$1:$version" for n in {1..5}; do
docker push "$1:$version" && break
echo 'Docker failed to push, wait 5 seconds'
sleep 5
done
else else
echo "Tagging release $1 with version ${version}" echo "Tagging release $1 with version ${version}"
docker tag "$1:$rev_version" "$1:$version" docker tag "$1:$rev_version" "$1:$version"
docker tag "$1:$rev_version" "$1:latest" docker tag "$1:$rev_version" "$1:latest"
docker push "$1:$version" for n in {1..5}; do
docker push "$1:latest" docker push "$1:$version" && break
echo 'Docker failed to push, wait 5 seconds'
sleep 5
done
for n in {1..5}; do
docker push "$1:latest" && break
echo 'Docker failed to push, wait 5 seconds'
sleep 5
done
fi fi

View File

@ -1,4 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "Tagging release $1 with version $2" echo "Tagging release $1 with version $2"
docker tag "$1" "$1:$2" docker tag "$1" "$1:$2"
docker push "$1:$2" for n in {1..5}; do
docker push "$1:$2" && break
echo 'Docker failed to push, wait 5 seconds'
sleep 5
done