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