ci: refs #6695 update Cypress Docker setup and improve container management in Jenkinsfile
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-19 09:09:35 +01:00
parent 12e1e8ac3d
commit 5f5ef3df41
1 changed files with 13 additions and 11 deletions

24
Jenkinsfile vendored
View File

@ -103,6 +103,7 @@ pipeline {
cleanDockerE2E() cleanDockerE2E()
sh "pnpm exec cypress install" sh "pnpm exec cypress install"
// sh "docker build -t cypress-setup:latest -f ./test/cypress/Dockerfile ." // sh "docker build -t cypress-setup:latest -f ./test/cypress/Dockerfile ."
docker.build('cypress-setup:latest', "-f ./test/cypress/Dockerfile .")
} }
} }
@ -113,14 +114,15 @@ pipeline {
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d" sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d"
def networkLowerCase = env.NETWORK.toLowerCase() def networkLowerCase = env.NETWORK.toLowerCase()
def containerId = sh(script: """ def containerId = sh(script: """
docker run --network ${networkLowerCase}_default \ docker run --name ${env.NETWORK}_cypress
-e TZ=Europe/Madrid \ --network ${networkLowerCase}_default \
-e DOCKER=true \ -e TZ=Europe/Madrid \
-e CI=true \ -e DOCKER=true \
-v .:/app \ -e CI=true \
-w /app \ -v .:/app \
cypress-setup:latest \ -w /app \
sh -c "while [ ! -d node_modules/cypress ]; do sleep 1; done && pnpm exec cypress run --browser chromium" cypress-setup:latest \
pnpm exec cypress run --browser chromium
""", returnStdout: true).trim() """, returnStdout: true).trim()
checkErrors(containerId) checkErrors(containerId)
} }
@ -173,9 +175,9 @@ pipeline {
def cleanDockerE2E() { def cleanDockerE2E() {
script { script {
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml down || true" sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml down || true"
// if (containerId?.trim()) { if (containerId?.trim()) {
// sh "docker rm ${containerId} || true" sh "docker rm ${containerId} || true"
// } }
} }
} }