From 73f29ec3a44ff1b153aa6db320173238d1bb5065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Irving=20L=C3=B3pez?= Date: Fri, 5 Jun 2026 12:59:29 -0500 Subject: [PATCH] fix(ci): helm-deploy tolerante a cluster no-listo (GOLDEN-PATH-BUILD-DEPLOY-ORDER-RACE) Job cluster-gate -> helm-deploy con if needs.cluster-gate.outputs.ready=='true'. Sin KUBECONFIG_TENANT_B64 (cluster aprovisionando) el deploy queda SKIPPED, no rojo. tenant-manager (fase 2 deploy-ready) dispara workflow_dispatch al sembrar el kubeconfig -> run #2 despliega. Sincronizado desde coralware/IDP commit a27e153. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/APP_NAME-build.yaml | 33 +++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/APP_NAME-build.yaml b/.gitea/workflows/APP_NAME-build.yaml index edf899b..c6cb233 100644 --- a/.gitea/workflows/APP_NAME-build.yaml +++ b/.gitea/workflows/APP_NAME-build.yaml @@ -84,12 +84,43 @@ jobs: -t "${REGISTRY}/${IMAGE}:${TAG}" \ --push . + # ── Gate de cluster listo (GOLDEN-PATH-BUILD-DEPLOY-ORDER-RACE) ────────── + # El kubeconfig (secret KUBECONFIG_TENANT_B64) lo siembra tenant-manager en su + # fase 2 (deploy-ready) cuando el cluster RKE2 del tenant está Ready (~8 min). + # En el primer run (disparado por el commit de bootstrap) el cluster aún se + # está aprovisionando: este gate marca `ready=false` → el job helm-deploy se + # SKIPEA (no falla, no rojo). La imagen ya quedó publicada en el job build. + # tenant-manager dispara automáticamente un segundo run (workflow_dispatch) al + # sembrar el kubeconfig → ahí helm-deploy corre y la app queda viva. + cluster-gate: + name: ¿Cluster del tenant listo? + needs: build + runs-on: [self-hosted, buildkit] + outputs: + ready: ${{ steps.check.outputs.ready }} + steps: + - name: Verificar kubeconfig sembrado + id: check + env: + KUBECONFIG_B64: ${{ secrets.KUBECONFIG_TENANT_B64 }} + run: | + if [ -z "$KUBECONFIG_B64" ]; then + echo "::notice::Imagen publicada en Harbor ✅. El cluster del tenant se está aprovisionando (~8 min); el deploy se ejecutará automáticamente cuando esté listo (run #2)." + echo "ready=false" >> "$GITHUB_OUTPUT" + else + echo "ready=true" >> "$GITHUB_OUTPUT" + fi + # ── Deploy al cluster del tenant — Helm upgrade --install (sin hook Alembic) ─ # El runner corre executor=host: los steps se ejecutan directo sobre el pod # runner, sin `container:`. helm se instala en runtime. + # Solo corre cuando el cluster está listo (cluster-gate). En caso contrario el + # job aparece como skipped (no failure) — separa "imagen publicada" de + # "app desplegada" como dos hitos. helm-deploy: name: Helm upgrade --install - needs: build + needs: [build, cluster-gate] + if: needs.cluster-gate.outputs.ready == 'true' runs-on: [self-hosted, buildkit] steps: - uses: actions/checkout@v4