From b8cbdf059dd9d33d61ff31de76752680e8f263a4 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sun, 18 Oct 2026 18:09:48 +0200 Subject: [PATCH] Make chart promotion resilient --- .gitea/workflows/chart.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/chart.yml b/.gitea/workflows/chart.yml index 25a776c..2a1bd82 100644 --- a/.gitea/workflows/chart.yml +++ b/.gitea/workflows/chart.yml @@ -24,6 +24,11 @@ jobs: --request POST \ --upload-file "dist/coturn-${version}.tgz" \ https://code.brunner.ninja/api/packages/feedc0de/helm/api/charts + - name: Check that this is still current main + if: gitea.ref == 'refs/heads/main' + run: | + git fetch --no-tags origin main + test "$(git rev-parse FETCH_HEAD)" = "${GITEA_SHA}" - name: Check out GitOps if: gitea.ref == 'refs/heads/main' uses: actions/checkout@v4 @@ -42,4 +47,14 @@ jobs: git add bootstrap/coturn.yaml if git diff --cached --quiet; then exit 0; fi git commit -m "Deploy coturn chart ${CHART_VERSION}" - git push origin HEAD:main + for attempt in 1 2 3; do + if git push origin HEAD:main; then + exit 0 + fi + if [ "${attempt}" = 3 ]; then + echo "GitOps promotion failed after three attempts" >&2 + exit 1 + fi + git fetch origin main + git rebase origin/main + done