From 8e3a1b17160331da47c2ea24f39f0a5b7ce798d0 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 4 Apr 2022 17:08:18 +0200 Subject: [PATCH] Update 'Jenkinsfile' add send mail post build action --- Jenkinsfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f824d8f..4ab75cb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,4 +47,20 @@ pipeline { } } } + // post-build actions + post { + success { + echo 'The docker pipeline worked!' + emailext to: 'jenkinsbuilds@d4science.org', + subject: "[Jenkins DockerPipeline D4S] build ${currentBuild.fullDisplayName} worked", + body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}" + } + failure { + echo 'The docker pipeline has failed' + emailext attachLog: true, + to: 'jenkinsbuilds@d4science.org', + subject: "[Jenkins DockerPipeline D4S] build ${currentBuild.fullDisplayName} failed for image ${imagename}", + body: "Something is wrong with ${env.BUILD_URL}" + } + } }