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) <noreply@anthropic.com>
This commit is contained in:
@@ -84,12 +84,43 @@ jobs:
|
|||||||
-t "${REGISTRY}/${IMAGE}:${TAG}" \
|
-t "${REGISTRY}/${IMAGE}:${TAG}" \
|
||||||
--push .
|
--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) ─
|
# ── Deploy al cluster del tenant — Helm upgrade --install (sin hook Alembic) ─
|
||||||
# El runner corre executor=host: los steps se ejecutan directo sobre el pod
|
# El runner corre executor=host: los steps se ejecutan directo sobre el pod
|
||||||
# runner, sin `container:`. helm se instala en runtime.
|
# 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:
|
helm-deploy:
|
||||||
name: Helm upgrade --install
|
name: Helm upgrade --install
|
||||||
needs: build
|
needs: [build, cluster-gate]
|
||||||
|
if: needs.cluster-gate.outputs.ready == 'true'
|
||||||
runs-on: [self-hosted, buildkit]
|
runs-on: [self-hosted, buildkit]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user