diff --git a/Jenkinsfile b/Jenkinsfile index 61bb6a1..1bc6f0c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,21 +8,11 @@ pipeline { } } post { - failure { - emailext body: 'Check console output at $BUILD_URL to view the results. \n\n ${CHANGES} \n\n -------------------------------------------------- \n${BUILD_LOG, maxLines=100, escapeHtml=false}', - to: "${EMAIL_TO}", - subject: 'Build failed in Jenkins: $PROJECT_NAME - #$BUILD_NUMBER' - } - unstable { - emailext body: 'Check console output at $BUILD_URL to view the results. \n\n ${CHANGES} \n\n -------------------------------------------------- \n${BUILD_LOG, maxLines=100, escapeHtml=false}', - to: "${EMAIL_TO}", - subject: 'Unstable build in Jenkins: $PROJECT_NAME - #$BUILD_NUMBER' - } - changed { - emailext body: 'Check console output at $BUILD_URL to view the results.', - to: "${EMAIL_TO}", - subject: 'Jenkins build is back to normal: $PROJECT_NAME - #$BUILD_NUMBER' - } + always { + script { + if (currentBuild.currentResult == 'FAILURE') { + step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "a.romanov@ulstu.ru", sendToIndividuals: true]) } + } } } \ No newline at end of file