fix(jenkins): mejorar diagnóstico de error 401 en verificación de Keycloak

HTTP 401 indica credenciales inválidas o Direct Access Grants deshabilitado,
no que Keycloak sea inaccesible. El mensaje ahora diferencia ambos casos
y da instrucciones específicas para resolverlo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 13:31:55 -05:00
parent d99429b58a
commit c807838455

9
Jenkinsfile vendored
View File

@@ -229,8 +229,13 @@ pipeline {
-d "grant_type=password&client_id=anexo76-frontend&username=${E2E_TEST_USER}&password=${E2E_TEST_PASSWORD}&scope=openid" \
2>/dev/null || echo "000")
echo "Keycloak token endpoint → HTTP ${KC_STATUS}"
if [ "$KC_STATUS" != "200" ]; then
echo "ERROR: Keycloak no accesible o password grant no habilitado (HTTP ${KC_STATUS})."
if [ "$KC_STATUS" = "401" ]; then
echo "ERROR 401 — Credenciales inválidas o Direct Access Grants deshabilitado."
echo " Verifica en Keycloak: Clients → anexo76-frontend → Settings → Direct access grants = ON"
echo " Verifica que el usuario '${E2E_TEST_USER}' exista en el realm y la contraseña sea correcta."
exit 1
elif [ "$KC_STATUS" != "200" ]; then
echo "ERROR: Keycloak no accesible (HTTP ${KC_STATUS})."
echo "URL: ${KC_TOKEN_EP}"
exit 1
fi