Files
jfengandClaude Opus 5.5 c9511a636e
CI - Validacao Go / Validar Codigo e Testes (push) Successful in 1m48s
ci: retry registry login, pull and push
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]>
2026-11-11 07:52:15 -03:00

72 lines
2.2 KiB
YAML

name: Docker - Promover latest
# :latest = ultimo release v* contido em maintained-stable.
# Nao recompila: baixa a imagem imutavel <versao>-<sha7> ja publicada pelo
# docker-build.yml para aquela tag e apenas a re-etiqueta, preservando o digest.
# So roda quando maintained-stable avanca (promocao aprovada) ou manualmente.
on:
push:
branches:
- maintained-stable
workflow_dispatch:
concurrency:
group: promote-latest
cancel-in-progress: false
env:
REGISTRY: git.jf.eng.br
IMAGE: git.jf.eng.br/jfeng/evogo
jobs:
promote:
name: Promover release para latest
runs-on: ubuntu-latest
steps:
- name: Checkout do Repositorio
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Identificar release
id: rel
run: |
git fetch --tags --force
TAG=$(git describe --tags --abbrev=0 --match 'v*' HEAD)
SHA7=$(git rev-list -n1 "$TAG" | cut -c1-7)
VERSION="${TAG#v}"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "source=${IMAGE}:${VERSION}-${SHA7}" >> "$GITHUB_OUTPUT"
echo "Release: ${TAG} -> ${IMAGE}:${VERSION}-${SHA7}"
- name: Login no Gitea Package Registry
run: |
USER="${{ secrets.REGISTRY_USER }}"
[ -n "$USER" ] || USER="${{ github.actor }}"
TOKEN="${{ secrets.REGISTRY_TOKEN }}"
[ -n "$TOKEN" ] || TOKEN="${{ secrets.GITEA_TOKEN }}"
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: Re-etiquetar como latest
run: |
retry() {
for n in 1 2 3 4 5; do
"$@" && return 0
echo "'$*' falhou (tentativa $n/5); nova tentativa em $((n*15))s"
sleep $((n*15))
done
return 1
}
SRC="${{ steps.rel.outputs.source }}"
retry docker pull "$SRC"
docker tag "$SRC" "$IMAGE:latest"
retry docker push "$IMAGE:latest"
echo "Publicado: $IMAGE:latest (mesmo digest de $SRC)"