ci: retry registry login, pull and push
CI - Validacao Go / Validar Codigo e Testes (push) Successful in 1m48s
CI - Validacao Go / Validar Codigo e Testes (push) Successful in 1m48s
A transient timeout on the registry token endpoint failed the publication of v0.7.2-evogo.2 (run 482) after the image had already been built and scanned. Login, pull and push now retry up to 5 times with linear backoff. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5b71495e93
commit
c9511a636e
3 files changed
+35
-6
No files matched your search
@@ -97,20 +97,34 @@ jobs:
|
||||
[ -n "$USER" ] || USER="${{ github.actor }}"
|
||||
TOKEN="${{ secrets.REGISTRY_TOKEN }}"
|
||||
[ -n "$TOKEN" ] || TOKEN="${{ secrets.GITEA_TOKEN }}"
|
||||
echo "$TOKEN" | docker login "$REGISTRY" -u "$USER" --password-stdin
|
||||
# O registry ja estourou timeout pontualmente (run 482); tenta de novo antes de falhar.
|
||||
for n in 1 2 3 4 5; do
|
||||
echo "$TOKEN" | docker login "$REGISTRY" -u "$USER" --password-stdin && exit 0
|
||||
echo "Login falhou (tentativa $n/5); nova tentativa em $((n*15))s"
|
||||
sleep $((n*15))
|
||||
done
|
||||
exit 1
|
||||
|
||||
- name: Publicar Imagens no Registry
|
||||
if: steps.meta.outputs.publish == 'true'
|
||||
run: |
|
||||
push() {
|
||||
for n in 1 2 3 4 5; do
|
||||
docker push "$1" && return 0
|
||||
echo "Push de $1 falhou (tentativa $n/5); nova tentativa em $((n*15))s"
|
||||
sleep $((n*15))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
SRC=evogo:ci-${{ steps.meta.outputs.commit_sha }}
|
||||
for TAG in "${{ steps.meta.outputs.image_tag }}" "${{ steps.meta.outputs.version }}"; do
|
||||
docker tag "$SRC" "$IMAGE:$TAG"
|
||||
docker push "$IMAGE:$TAG"
|
||||
push "$IMAGE:$TAG"
|
||||
echo "Publicado: $IMAGE:$TAG"
|
||||
done
|
||||
if [ "${{ github.event.inputs.promote_latest }}" = "true" ]; then
|
||||
docker tag "$SRC" "$IMAGE:latest"
|
||||
docker push "$IMAGE:latest"
|
||||
push "$IMAGE:latest"
|
||||
echo "Publicado: $IMAGE:latest"
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user