Vers Nice, appreciate your feedback. Glad that We could help you :)

-------- Ursprüngliche Nachricht --------
Von: Faad Sayaou <faad...@gmail.com>
Datum: 01.03.19 08:34 (GMT+01:00)
An: jenkinsci-users@googlegroups.com
Betreff: Re: sending email for unstable builds

thanks @Simon and @Sagar for your responses.  'currentBuild.currentResult' is 
definitely what i needed and works as intended.

On Fri, 1 Mar 2019 at 06:37, Simon Bayer 
<schn...@msn.com<mailto:schn...@msn.com>> wrote:
Check This if u need post build actions for different build status: 
https://jenkins.io/doc/pipeline/tour/post/


-------- Ursprüngliche Nachricht --------
Von: Simon Bayer <schn...@msn.com<mailto:schn...@msn.com>>
Datum: 01.03.19 06:32 (GMT+01:00)
An: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>
Betreff: Re: sending email for unstable builds

Dear Faad, dear Sagar,
U could check the global variable  'currentBuild.currentResult' in e.g. post 
build actions. Maybe it suits your needs. Doks: 
https://opensource.triology.de/jenkins/pipeline-syntax/globals#currentBuild

Best regards


-------- Ursprüngliche Nachricht --------
Von: Sagar Utekar <sagar.ute...@gslab.com<mailto:sagar.ute...@gslab.com>>
Datum: 01.03.19 03:06 (GMT+01:00)
An: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>
Betreff: Re: sending email for unstable builds

You can check the status of build by using BUILD_STATUS, if it is unstable then 
send a mail

On Fri, 1 Mar 2019, 02:11 Faad Sayaou, 
<faad...@gmail.com<mailto:faad...@gmail.com>> wrote:
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-ma.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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2c7db49d-68ef-4c41-8cd2-39ff6855ad83%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/2c7db49d-68ef-4c41-8cd2-39ff6855ad83%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANYh6tf5h6_LAafRrKLROquy3mO95puNkbMY0%3DATh5uRnkXeyw%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CANYh6tf5h6_LAafRrKLROquy3mO95puNkbMY0%3DATh5uRnkXeyw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/DM6PR15MB3452B3FF105E05324B50A9C4AC760%40DM6PR15MB3452.namprd15.prod.outlook.com<https://groups.google.com/d/msgid/jenkinsci-users/DM6PR15MB3452B3FF105E05324B50A9C4AC760%40DM6PR15MB3452.namprd15.prod.outlook.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
Best Regards / Mit freundlichen Grüßen,
Faad Sayaou,
Embedded Systems for Mechatronics Masters student | FH Dortmund | Germany
Fachhochschule Dortmund
University of Applied Sciences and Arts
Email: 
f<mailto:ahmedyasse...@outlook.com>aad...@gmail.com<mailto:aad...@gmail.com>


--
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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAL2KjjQ-6Q66229-Zh-5BRYtMvRANN-dmOZCwteJ7Re9n%3D1Tcw%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAL2KjjQ-6Q66229-Zh-5BRYtMvRANN-dmOZCwteJ7Re9n%3D1Tcw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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/BN8PR15MB3441D00AC2AAA06CB8709368AC760%40BN8PR15MB3441.namprd15.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to