Move vagrant destroy server to post action

nginx_conf
Nicolas Arenas 2024-10-01 13:32:31 +02:00
parent 7f76546392
commit 57ec16bd5b
1 changed files with 6 additions and 9 deletions

View File

@ -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()