Jenkins build Failed but all stages Succeeded Jenkins build Failed but all stages Succeeded jenkins jenkins

Jenkins build Failed but all stages Succeeded


As the send email step is failing, can you try using:

environment {            EMAIL_TO = 'someone@host.com'        }    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'            }        }


You need to check the Console log of that job, though all the stages Succeded, there must be a step that is failing at last part.


If you want to send an e-mail to the right developer, you can try something like this :

pipeline {    agent any     stages {        stage('A') {            steps {                ...            }        }        stage('Test') {            steps {                ...            }        }    }    post {         always {                emailext  body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",                recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],                subject: "[Jenkins] Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"        }    }}