From 59aebc8f48a79bd3722ea6f2757d98159a6118e5 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Tue, 5 Jan 2021 02:28:31 +0100 Subject: [PATCH] added email on failure --- jenkinsfile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/jenkinsfile b/jenkinsfile index 958f50b..5cf1ebb 100644 --- a/jenkinsfile +++ b/jenkinsfile @@ -18,10 +18,25 @@ pipeline { sshPublisher(publishers: [sshPublisherDesc(configName: 'centnas', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/$JOB_NAME', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'HelloWorld-amd64*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) // Cleaning WorkSpace cleanWs() - // send Mail - //Send To person to make commit emailext body: '$DEFAULT_CONTENT', recipientProviders: [culprits()], subject: '$DEFAULT_SUBJECT', to: 'bramm.p11@gmail.com' - //Send To static addres emailext body: '$DEFAULT_CONTENT', subject: '$DEFAULT_SUBJECT', to: 'bramm.p11@gmail.com' } } } + post { + success { + echo 'Build successful' + } + failure { + // Send To person to make commit + //emailext body: '$DEFAULT_CONTENT', recipientProviders: [culprits()], subject: '$DEFAULT_SUBJECT' + + // Send To static addres + emailext body: '$DEFAULT_CONTENT', subject: '$DEFAULT_SUBJECT', to: 'bram@bprieshof.nl' + } + unstable { + echo 'Build unstable' + } + changed { + echo 'Pipeline has changed' + } + } } \ No newline at end of file