From 5a4bbfd739f6f710676989f0949b90d518f7c732 Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Fri, 22 May 2026 14:02:09 -0500 Subject: [PATCH] fix(ci): pasar credenciales SITAR al backend del stack E2E MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sin SITAR_API_URL/USER/PASSWORD, el botón "Consultar DOF" del dialog ExchangeRateGuard nunca llena el input (el backend no tiene cómo pedir el TC) y auth.setup.ts:72 falla con timeout. En el E2E viejo no salía porque apuntaba a dev en vivo, donde ya había TC para hoy y el dialog ni se abría. Cambios: - docker-compose.e2e.yml: backend recibe SITAR_API_URL/USER/PASSWORD por env var passthrough con defaults vacíos. - Jenkinsfile: lee a76-sitar-api-url (string) y a76-sitar-credentials (usernamePassword) vía withCredentials y los inyecta. - Cleanup ahora dumpea las últimas 200 líneas del backend cuando el stack está arriba, para diagnosticar fallas opacas (auth, SITAR, migraciones, etc.) sin tener que repetir el build. Requiere en Jenkins: - a76-sitar-api-url (Secret Text) - a76-sitar-credentials (Username with password) Co-Authored-By: Claude Opus 4.7 (1M context) --- Jenkinsfile | 14 ++++++++++++++ docker-compose.e2e.yml | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7814fbcc..2001024d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,8 @@ // - dev-server-host : Secret Text — hostname/IP del servidor dev // - dev-server-ssh : SSH Username with Private Key — llave privada para deploy // - a76-e2e-credentials : Username with password — usuario de prueba en Workspace +// - a76-sitar-api-url : Secret Text — URL del API SITAR (provee TC para "Consultar DOF") +// - a76-sitar-credentials : Username with password — credenciales del API SITAR // // El agente Jenkins solo necesita: Docker CLI @@ -308,6 +310,12 @@ pipeline { credentialsId: 'a76-e2e-credentials', usernameVariable: 'E2E_USER', passwordVariable: 'E2E_PASS' + ), + string(credentialsId: 'a76-sitar-api-url', variable: 'SITAR_API_URL'), + usernamePassword( + credentialsId: 'a76-sitar-credentials', + usernameVariable: 'SITAR_API_USER', + passwordVariable: 'SITAR_API_PASSWORD' ) ]) { sh ''' @@ -325,6 +333,12 @@ pipeline { cleanup() { echo "=== E2E cleanup ===" + # Dump logs del backend si el stack está arriba — ayuda a diagnosticar + # fallas de auth/SITAR/migraciones que de otro modo quedan opacas. + if docker compose -p "$PROJECT" -f docker-compose.e2e.yml ps -q backend >/dev/null 2>&1; then + echo "--- logs backend (últimas 200 líneas) ---" + docker compose -p "$PROJECT" -f docker-compose.e2e.yml logs --tail=200 backend 2>&1 || true + fi docker rm -f "$PLAYWRIGHT_C" >/dev/null 2>&1 || true docker compose -p "$PROJECT" -f docker-compose.e2e.yml down -v --remove-orphans >/dev/null 2>&1 || true docker rmi -f "$FE_IMAGE_E2E" >/dev/null 2>&1 || true diff --git a/docker-compose.e2e.yml b/docker-compose.e2e.yml index 2793a079..96213017 100644 --- a/docker-compose.e2e.yml +++ b/docker-compose.e2e.yml @@ -80,6 +80,12 @@ services: - VALKEY_URL=redis://valkey:6379/0 - HUB_URL=https://workspace.aduanasoft.com - APP_PUBLIC_URL=http://localhost:5173 + # SITAR — proveedor del tipo de cambio (botón "Consultar DOF" del dialog + # de ExchangeRateGuard). Sin estas vars el dialog nunca llena el input + # y auth.setup.ts falla. Las credenciales se inyectan desde Jenkins. + - SITAR_API_URL=${SITAR_API_URL:-} + - SITAR_API_USER=${SITAR_API_USER:-} + - SITAR_API_PASSWORD=${SITAR_API_PASSWORD:-} - CSV_IMPORT_STORAGE=minio - S3_ENDPOINT_URL=http://minio:9000 - S3_ACCESS_KEY=minioadmin