From 110f7e337041accb2f0b1a71d7d8693e906dc4de Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Tue, 1 Oct 2024 12:08:05 +0200 Subject: [PATCH] Add mail notification to Jenkinsfile --- tests/API-dhcp/Jenkinsfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/API-dhcp/Jenkinsfile b/tests/API-dhcp/Jenkinsfile index cd29f85..b448c11 100644 --- a/tests/API-dhcp/Jenkinsfile +++ b/tests/API-dhcp/Jenkinsfile @@ -30,7 +30,7 @@ pipeline { echo "$QINDEL_PASS" | sudo -S bash -c "echo '$new_ip api-test' >> /etc/hosts" echo "IP: $new_ip" curl -f -L -X 'GET' -H 'accept: application/json' "http://api-test/opengnsys3/rest/dhcp/subnets/" - ''' + ''' } } } @@ -48,4 +48,21 @@ pipeline { } } } + post { + always { + script { + def commiterEmail = sh(script: 'git log -1 --pretty=format:%ae', returnStdout: true).trim() + emailext( + to: "${committerEmail}", + subject: "Jenkins Job Completed: ${env.JOB_NAME} #${env.BUILD_NUMBER}", + body: """ + El job '${env.JOB_NAME}' con nĂºmero de build ${env.BUILD_NUMBER} ha finalizado. + + Estado: ${currentBuild.currentResult} + + Revisa los detalles del build en: ${env.BUILD_URL} + """ + } + } + } }