Victor, thanks for the help here. I have played with the 'changed' action and also currentBuild.result and currentBuild?.getPreviousBuild(), but it looks like this variable is null unless explicitly set in one of the pipeline stages. What I really want is the status Jenkins uses to determine which post condition is applicable, i.e. success, failure, etc. It knows somehow, presumably based on $? values from each step.
On Wednesday, August 16, 2017 at 5:05:27 AM UTC-5, Victor Martinez wrote: > > Hey Dallas, > > Cannot you just use the changed condition > https://jenkins.io/doc/book/pipeline/syntax/#post? Then you can use the > http://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html#resultIsBetterOrEqualTo-java.lang.String- > > See the below snippet: > > ... > post { > changed { > script { > // > http://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html#resultIsBetterOrEqualTo-java.lang.String- > if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) { > echo "Previous build failed > ${currentBuild?.getPreviousBuild()?.number} and now it has been fixed" > } > } > } > } > ... > > > 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/f7e40755-50c6-4077-9288-a9336476f9aa%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
