From a6968ca83a1d3a3bdb57240f1657787e2d85d0cf Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Tue, 1 Oct 2024 13:32:31 +0200 Subject: [PATCH] Move vagrant destroy server to post action --- tests/API-dhcp/Jenkinsfile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/API-dhcp/Jenkinsfile b/tests/API-dhcp/Jenkinsfile index c779e82..f08374d 100644 --- a/tests/API-dhcp/Jenkinsfile +++ b/tests/API-dhcp/Jenkinsfile @@ -43,20 +43,17 @@ pipeline { echo 'Running API tests' } } - stage('Clean up') { - steps { - dir ('tests/API-dhcp') { - echo "Destroy API server for DHCP with Vagrant" - // sh 'vagrant destroy -f' - } - } - } } post { + success { + script { + echo "El trabajo ha finalizado con éxito. Destruyendo máquina Vagrant..." + sh 'vagrant destroy -f' + } + } always { script { def userCause = currentBuild.rawBuild.getCause(hudson.model.Cause$UserIdCause) - if (userCause != null) { // Si fue lanzado manualmente, obtener el usuario y su correo desde las propiedades de Jenkins def userId = userCause.getUserId()