From 5f5ef3df416d4ed56736a463713d36d247b0dbdc Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 19 Feb 2025 09:09:35 +0100 Subject: [PATCH] ci: refs #6695 update Cypress Docker setup and improve container management in Jenkinsfile --- Jenkinsfile | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f2514d174..a4c3095a6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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" + } } }