Victor, you are sure right.  This works like a champ!  Thank you very much. 
 Do you know if it's possible to get the status for each stage in a 
pipeline?

On Wednesday, August 16, 2017 at 10:13:46 AM UTC-5, Victor Martinez wrote:
>
> As far as I see "currentBuild.getCurrentResult()" is not null even though 
> when no set was explicitly set, this is my snippet and console output
>
> pipeline {
>     agent any
>     stages {
>         stage ('release') {
>             steps {
>                 script {
>                     echo "echo currentbuild ${BUILD_ID}"
>                     //sh 'exit 1'
>                 }
>             }
>         }
>     }
>     post {
>         changed {
>             script {
>                 echo "${currentBuild.getCurrentResult()}"
>                 if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
>                     echo "Previous build failed 
> ${currentBuild?.getPreviousBuild()?.number} and now it has been fixed"
>                 }
>             }
>         }
>     }
> }
>
> [Pipeline] nodeRunning on master in 
> /var/jenkins_home/workspace/_scratch/test_def[Pipeline] {[Pipeline] 
> stage[Pipeline] { (release)[Pipeline] script[Pipeline] {[Pipeline] echoecho 
> currentbuild 37[Pipeline] }[Pipeline] // script[Pipeline] }[Pipeline] // 
> stage[Pipeline] stage[Pipeline] { (Declarative: Post Actions)[Pipeline] 
> script[Pipeline] {[Pipeline] echoSUCCESS[Pipeline] echoPrevious build failed 
> 36 and now it has been fixed[Pipeline] }[Pipeline] // script[Pipeline] 
> }[Pipeline] // stage[Pipeline] }[Pipeline] // node[Pipeline] End of 
> PipelineFinished: SUCCESS
>
>
> Cheers
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/4adbb842-6f3f-4605-9497-15a050a792bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to