diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 688408f..9170b73 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -69,14 +69,23 @@ jobs: GITHUB_SHA: ${{ github.sha }} REGISTRY: ${{ env.REGISTRY }} + - name: Install jq + run: apk add --no-cache jq 2>/dev/null || true + - name: Patch ArgoCD run: | SHORT=${GITHUB_SHA::8} - if kubectl -n cicd get application demo-frontend &>/dev/null; then - kubectl -n cicd patch application demo-frontend --type merge \ - -p "{\"spec\":{\"source\":{\"helm\":{\"parameters\":[{\"name\":\"image.registry\",\"value\":\"${REGISTRY}\"},{\"name\":\"image.tag\",\"value\":\"${SHORT}\"}]}}}}" - echo "✓ ArgoCD app patched" - fi + for i in {1..10}; do + if kubectl -n cicd get application demo-frontend &>/dev/null; then + break + fi + echo "Waiting for ArgoCD application..." + sleep 3 + done + PATCH=$(jq -n --arg tag "$SHORT" --arg reg "$REGISTRY" \ + '{"spec":{"source":{"helm":{"parameters":[{"name":"image.registry","value":$reg},{"name":"image.tag","value":$tag}]}}}}') + kubectl -n cicd patch application demo-frontend --type=merge -p "$PATCH" + echo "✓ ArgoCD updated with tag ${SHORT}" env: GITHUB_SHA: ${{ github.sha }} REGISTRY: ${{ env.REGISTRY }}