Enhance Jenkinsfile for E2E testing diagnostics

- Added a 10-second sleep before the E2E testing begins to allow Vite/Uvicorn to start up, improving log visibility for troubleshooting.
- Included commands to output the status of the Docker containers and the last 40 lines of logs for both frontend and backend services, aiding in debugging during the E2E testing process.
- Adjusted the timeout for waiting on the frontend from 300 seconds to 180 seconds, streamlining the waiting logic.
This commit is contained in:
2026-04-24 16:26:56 -05:00
parent 5196685ea6
commit c06b51c18e

17
Jenkinsfile vendored
View File

@@ -280,6 +280,17 @@ pipeline {
exit 1
fi
# Dump temprano: 10s tras el up para ver arranque de Vite/Uvicorn antes de
# que el wait empiece a iterar; si algo falla, queda en logs sin esperar
# al timeout.
sleep 10
echo "== E2E: estado del stack tras 10s =="
e2e_compose ps -a 2>&1 || true
echo "--- docker logs anexo76-frontend --tail 40 ---"
docker logs --tail 40 anexo76-frontend 2>&1 || true
echo "--- docker logs anexo76-backend --tail 40 ---"
docker logs --tail 40 anexo76-backend 2>&1 || true
# Playwright con docker cp (no -v): el workspace del agente Jenkins puede
# no ser visible al docker daemon. `--network host` conecta al host del
# daemon, donde compose publica 5173/8000 (el agente Jenkins NO ve esos
@@ -321,12 +332,12 @@ pipeline {
i=0
until curl -fsS --connect-timeout 3 --max-time 5 http://127.0.0.1:5173/ >/dev/null 2>&1; do
i=$((i + 5))
if [ "$i" -ge 300 ]; then
echo "ERROR: timeout esperando frontend (300s)"
if [ "$i" -ge 180 ]; then
echo "ERROR: timeout esperando frontend (180s)"
exit 1
fi
if [ $((i % 30)) -eq 0 ]; then
echo " ...esperando frontend (${i}/300s)"
echo " ...esperando frontend (${i}/180s)"
fi
sleep 5
done