fix: refs #6695 try parallel
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-10 13:10:12 +01:00
parent 2fcc7c94b8
commit 6d7199b2ff
1 changed files with 16 additions and 8 deletions

24
Jenkinsfile vendored
View File

@ -183,20 +183,28 @@ def cleanDockerE2E() {
}
def runTestsInParallel() {
def integrationTests = sh(script: "ls -d test/cypress/integration/*/", returnStdout: true).trim().split('\n')
// def integrationTests = sh(script: "ls -d test/cypress/integration/*/ || echo ''", returnStdout: true).trim().split('\n')
def integrationTests = ['test/cypress/integration/claim/', 'test/cypress/integration/client/']
def tasks = [:]
// Crear tareas para cada carpeta de tests
integrationTests.each { testFolder ->
def folderName = testFolder.replaceAll('test/cypress/integration/', '').replaceAll('/', '')
tasks["e2e_${folderName}"] = {
sh "docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up -d back db"
sh "docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up -d front"
sh "docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up e2e " +
"command=\"sh -c 'pnpm exec cypress install && pnpm exec cypress run --browser chromium --spec test/cypress/integration/${folderName}/**/*.spec.js'\""
if (testFolder.trim()) { // Evita procesar líneas vacías
def folderName = testFolder.replaceAll('test/cypress/integration/', '').replaceAll('/', '')
folderName = folderName.replaceAll('[^a-zA-Z0-9_-]', '') // Seguridad en nombres de red
tasks["e2e_${folderName}"] = {
sh """
docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml pull
docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up -d back vn-database
docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up -d front
docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up e2e \
command="sh -c 'pnpm exec cypress install && pnpm exec cypress run --browser chromium --spec test/cypress/integration/${folderName}/**/*.spec.js'" \
--abort-on-container-exit
"""
}
}
}
parallel tasks
}