Update Docker volumes in docker-compose.yml and enhance Jenkinsfile for frontend testing

- Changed PostgreSQL data volume paths in docker-compose.yml to remove the trailing 'data' directory.
- Improved the 'Test frontend' stage in Jenkinsfile by adding cleanup steps and ensuring the workspace is correctly copied to the Docker container for testing.
This commit is contained in:
2026-04-24 10:47:06 -05:00
parent 5933b161b5
commit 46c98dbc38
2 changed files with 23 additions and 10 deletions

29
Jenkinsfile vendored
View File

@@ -131,23 +131,36 @@ pipeline {
}
}
/* Frontend: i18n (paraglide no versionado) + vitest solo proyecto "server" (Node).
* "client" usa @vitest/browser+Playwright: requeriría playwright install (chromium) en el contenedor.
* pnpm run check svelte-check se omite mientras haya deuda de tipos en el árbol; pnpm run lint alinear cuando pase. */
// Test frontend: OBLIGATORIO usar el repo clonado (WORKSPACE), no la imagen del frontend en Harbor.
// Svelte se compila en el Dockerfile: la imagen de producción solo trae build/ + deps de runtime; no hay fuentes
// para vitest, ni paraglide desde inlang, ni pnpm devDependencies. Imagen usada aquí: solo node:22-bookworm.
// Mismo criterio que Test backend: docker cp (no -v) si Jenkins vive en Docker. Vitest: sin @vitest/browser en CI.
stage('Test frontend') {
steps {
sh '''
set -euxo pipefail
echo "== Test frontend (vitest —project server) =="
docker run --rm \
echo "== Test frontend (vitest) =="
FE_CONTAINER="anexo76-test-fe-${BUILD_NUMBER}"
cleanup() {
docker rm -f "$FE_CONTAINER" >/dev/null 2>&1 || true
}
trap cleanup EXIT
docker rm -f "$FE_CONTAINER" >/dev/null 2>&1 || true
docker run -d --name "$FE_CONTAINER" node:22-bookworm sleep infinity
docker exec "$FE_CONTAINER" mkdir -p /workspace
docker cp "$WORKSPACE/." "$FE_CONTAINER:/workspace"
docker exec \
-e CI=true \
-e NODE_ENV=test \
-e JENKINS_URL=${JENKINS_URL} \
-v "$WORKSPACE:/workspace" \
-e "JENKINS_URL=${JENKINS_URL}" \
-w /workspace/frontend \
node:22-bookworm \
"$FE_CONTAINER" \
bash -lc '
set -euxo pipefail
test -f package.json
node --version
corepack enable
pnpm --version