fix(jenkins): usar URL de Workspace para Keycloak en E2E

Keycloak vive en workspace.aduanasoft.com/kcauth, no en el servidor
de Anexo76. A76_URL/kcauth devuelve 502 porque el proxy del servidor
dev no rutea ese path a Keycloak.

- KC_URL = https://workspace.aduanasoft.com/kcauth (variable de entorno,
  no secret — no es dato sensible)
- E2E_KEYCLOAK_URL y KC_TOKEN_EP ahora usan KC_URL en lugar de A76_URL/kcauth

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 13:16:35 -05:00
parent c04b6876f6
commit cf84378a2e

7
Jenkinsfile vendored
View File

@@ -22,6 +22,9 @@ pipeline {
// Debe coincidir con @playwright/test del frontend (ver frontend/pnpm-lock.yaml)
PLAYWRIGHT_IMAGE = 'mcr.microsoft.com/playwright:v1.56.1-noble'
DEPLOY_PATH = '~/projects/anexo76'
// URL de Keycloak/Workspace accesible desde el agente Jenkins.
// Difiere de A76_URL/kcauth porque Keycloak vive en Workspace, no en el servidor de Anexo76.
KC_URL = 'https://workspace.aduanasoft.com/kcauth'
}
options {
@@ -204,7 +207,7 @@ pipeline {
-e VITE_KEYCLOAK_CLIENT_ID=anexo76-frontend \
-e KEYCLOAK_CLIENT_ID=anexo76-frontend \
-e ORIGIN=http://localhost:5173 \
-e "E2E_KEYCLOAK_URL=${A76_URL}/kcauth" \
-e "E2E_KEYCLOAK_URL=${KC_URL}" \
-e "E2E_TEST_USER=${E2E_USER}" \
-e "E2E_TEST_PASSWORD=${E2E_PASS}" \
-w /workspace/frontend \
@@ -217,7 +220,7 @@ pipeline {
# Verificar que Keycloak acepta el password grant
# (auth.setup.ts lo usa directamente — sin pasar por /login)
echo "--- Verificando Keycloak token endpoint ---"
KC_TOKEN_EP="${E2E_KEYCLOAK_URL}/realms/master/protocol/openid-connect/token"
KC_TOKEN_EP="${KC_URL}/realms/master/protocol/openid-connect/token"
# -s sin -f: curl no falla en HTTP 4xx/5xx, devuelve el código real
# || echo "000" solo se activa si curl no puede conectar (timeout, DNS, etc.)
KC_STATUS=$(curl -s --max-time 10 -o /dev/null -w "%{http_code}" \