To my knowledge, it's not possible to change the result of a single step. However, you can check the result code of your script and then set the result of the entire pipeline to UNSTABLE using *returnStatus* parameter, available for *sh*, *powershell* and *bat* steps <https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/>.
Alternatively, it's planned to have the ability to change the status of a single stage : see JENKINS-26522 <https://issues.jenkins-ci.org/browse/JENKINS-26522> The scope of this issue is wider than your need though, but it's in progress :-) 2017-07-19 15:42 GMT+02:00 Breitbach, Steffen <[email protected]>: > Hi everyone! > > > > Is there a way to mark a single step (or script) in a declarative Jenkins > pipeline as "UNSTABLE"? > > > > I know how to mark the entire pipeline as UNSTABLE and how to mark a > single step as FAILED instead of STABLE, but that's not what I need. > > > > Something like "currentStep.result = 'UNSTABLE'" would be handy. > > > > I haven't found something yet, assuming there isn't a solution for this, > but I thought I'll give it a shot and try asking here... > > > > Best regards > > Steffen > > > > -- > 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/5E63738AB9896844AF1601A1D09467 > 7317A6BF6B%40SMBXKO2.cgm.ag > <https://groups.google.com/d/msgid/jenkinsci-users/5E63738AB9896844AF1601A1D094677317A6BF6B%40SMBXKO2.cgm.ag?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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPO77c2nbzM_gK9tO3oiiRyhNJdi%2BpdGGPNr-2EFNmWwPxuMjg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
