From 41f0d67752a925bcfacfa1b2a5065b6dda9982ef Mon Sep 17 00:00:00 2001 From: BrahmanapallyNagaraju <44258487+BrahmanapallyNagaraju@users.noreply.github.com> Date: Wed, 8 Apr 2020 23:52:01 +0530 Subject: [PATCH] Added email notifaction --- Jenkinsfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ba8626a9c..6145e7ca0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,7 @@ +def targetMail = "bnagaraju96756@gmail.com,jenkinsautomationuser@gmail.com" +def emailDevOps(targetMail, msg) { + emailext body: "${msg}\nplease look into the build: ${BUILD_URL}", subject: "${currentBuild.result}: ${BUILD_TAG}", to: "${targetMail}" +} pipeline { agent {label "slave"} stages { @@ -6,7 +10,7 @@ stages { sh "pwd" sh "ls -lrtha" dir("spring-petclinic") { - sh "./mvnw package" + sh "./mvnw clean package" } } } @@ -22,4 +26,11 @@ stages { } } } +post { + always{ + deleteDir() + emailDevOps(targetMail, "This is the mail notification.") + + } +} }