Hi everyone
I am using the extended email plugin for notification when the build fails 
by using try catch. I will also like to send email when the build is 
unstable. Below is the structure of my pipeline 

node {
       
   try 
   {
 
    stage('Checkout') {
            cleanWs()
            checkout scm

        }


        stage('Restore') {

            sh "dotnet restore  $proj"

       }

        stage('Build') {
            sh "dotnet restore  $proj"

       }
        stage ('Unit test') {

           sh "dotnet test  $test"
       } 
   }
} catch (err) {
     emailext body: 
            ' ${JOB_NAME} ${BUILD_NUMBER} is failing! Somebody should do 
something about that. 
https://jenkins-map.1worldsync.com/job/Test/${BUILD_NUMBER}/console 
<https://jenkins-map.1worldsync.com/job/Heinemann_Build_pipeline/$%7BBUILD_NUMBER%7D/console>',
 subject: 'FAILURE', to: 'someEmail..'
    }


I will like to send not only when the pipeline fails but when the build is 
unstable. thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/18dd58b1-9352-4b31-ab90-5aecd326003a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to