test: refs #6695 try handle e2e erros and publish
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
32dbdbddbb
commit
db6783e9d4
|
@ -129,10 +129,21 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
sh 'docker-compose -f docker-compose.e2e.yml up e2e'
|
||||
def result = sh(script: 'docker-compose -f docker-compose.e2e.yml ps -q e2e | xargs docker inspect -f "{{.State.ExitCode}}"', returnStatus: true)
|
||||
sh 'docker cp $(docker-compose -f docker-compose.e2e.yml ps -q e2e):/app/test/cypress/reports ./test/cypress/'
|
||||
if (result != 0) {
|
||||
error("Cypress E2E tests failed with exit code: ${result}")
|
||||
// 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.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,14 +151,15 @@ pipeline {
|
|||
}
|
||||
post {
|
||||
always {
|
||||
publishHTML([
|
||||
allowMissing: true,
|
||||
alwaysLinkToLastBuild: true,
|
||||
keepAll: true,
|
||||
reportDir: 'test/cypress/reports',
|
||||
reportFiles: '*.html',
|
||||
reportName: 'Cypress Mochawesome Report'
|
||||
])
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue