test: refs #6695 try handle e2e erros and publish
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-03 08:47:11 +01:00
parent db6783e9d4
commit 040673f500
1 changed files with 2 additions and 17 deletions

19
Jenkinsfile vendored
View File

@ -94,7 +94,7 @@ pipeline {
CREDENTIALS = credentials('docker-registry')
}
stages {
stage('Steup') {
stage('Setup') {
steps {
script {
def packageJson = readJSON file: 'package.json'
@ -129,21 +129,15 @@ pipeline {
steps {
script {
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
// Obtener el ID del contenedor e2e
def containerId = sh(script: "docker-compose -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
if (containerId) {
// Obtener el exit code del contenedor
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
// Copiar reportes desde el contenedor a Jenkins
sh "docker cp ${containerId}:/app/test/cypress/reports ./test/cypress/"
// Si hubo errores en Cypress, fallar el build
if (exitCode != '0') {
error("Cypress E2E tests failed with exit code: ${exitCode}")
}
} else {
error("No se encontró el contenedor e2e.")
error("The Docker container for E2E tests could not be created")
}
}
}
@ -151,15 +145,6 @@ pipeline {
}
post {
always {
// sh 'docker cp $(docker-compose -f docker-compose.e2e.yml ps -q e2e):/app/test/cypress/reports ./test/cypress/' // in run
// publishHTML([
// allowMissing: true,
// alwaysLinkToLastBuild: true,
// keepAll: true,
// reportDir: 'test/cypress/reports',
// reportFiles: '*.html',
// reportName: 'Cypress Mochawesome Report'
// ])
cleanDockerE2E()
}
}