In Jenkins pipeline I have (using Extended Email plugin):
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage('install') {
steps {
echo 'install...'
}
}
}
post {
failure {
emailext body: 'fail', subject: 'failed', to: '[email protected]'
}
// always {}
}
}
When build fails it sends email. However, I want to send email also, when the pipeline syntax is broken itself, eg. if you uncomment the always {}
line above, you get:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 69: No steps specified for branch @ line 69, column 17.
always {
^
however, that build fails silently (bcz syntax issue). How to get emails on such cases too?