Update 'Jenkinsfile'

add sendMail as post build action
This commit is contained in:
Roberto Cirillo 2022-04-04 17:52:11 +02:00
parent 000b47c758
commit c9e160afe8
1 changed files with 17 additions and 1 deletions

18
Jenkinsfile vendored
View File

@ -45,6 +45,22 @@ pipeline {
sh "docker rmi $imagename:latest"
}
}
}
}
// 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}"
}
}
}