fix: refs #6695 try parallel
gitea/salix-front/pipeline/pr-dev Something is wrong with the build of this commit
Details
gitea/salix-front/pipeline/pr-dev Something is wrong with the build of this commit
Details
This commit is contained in:
parent
a31d6cf819
commit
2fcc7c94b8
|
@ -101,35 +101,16 @@ pipeline {
|
|||
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||
env.NETWORK = "${PROJECT_NAME}-${env.BRANCH_NAME}-${env.BUILD_ID}"
|
||||
cleanDockerE2E()
|
||||
// def repoFolder = "salix"
|
||||
// if (fileExists(repoFolder)) {
|
||||
// dir(repoFolder) {
|
||||
// sh 'git pull'
|
||||
// }
|
||||
// } else {
|
||||
// sh "git clone https://gitea.verdnatura.es/verdnatura/salix.git"
|
||||
// }
|
||||
sh "pnpm exec cypress install"
|
||||
sh "docker network create ${env.NETWORK} || true"
|
||||
// sh "docker network create ${env.NETWORK} || true"
|
||||
}
|
||||
// sh 'rm -rf salix'
|
||||
// sh 'git clone dev https://gitea.verdnatura.es/verdnatura/salix.git'
|
||||
}
|
||||
}
|
||||
stage('Up') {
|
||||
steps {
|
||||
// sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d db"
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d back"
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up -d front"
|
||||
|
||||
}
|
||||
}
|
||||
stage('Run E2E') {
|
||||
steps {
|
||||
script {
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml up e2e"
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml logs back"
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml logs vn-database"
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml logs front"
|
||||
runTestsInParallel()
|
||||
def containerId = sh(script: "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
|
||||
if (containerId) {
|
||||
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
|
||||
|
@ -192,7 +173,30 @@ def cleanDockerE2E() {
|
|||
script {
|
||||
// sh 'docker rm -f vn-database || true'
|
||||
// sh 'docker rm -f salix_e2e || true'
|
||||
sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml down --volumes || true"
|
||||
// sh "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml down --volumes || true"
|
||||
sh """
|
||||
docker ps -a --format '{{.Names}}' | grep '${env.NETWORK}' | xargs -r docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml down --volumes
|
||||
"""
|
||||
|
||||
sh "docker network rm ${env.NETWORK} || true"
|
||||
}
|
||||
}
|
||||
|
||||
def runTestsInParallel() {
|
||||
def integrationTests = sh(script: "ls -d test/cypress/integration/*/", returnStdout: true).trim().split('\n')
|
||||
|
||||
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'\""
|
||||
}
|
||||
}
|
||||
|
||||
parallel tasks
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue