On Fri, Apr 30, 2021 at 3:31 AM [email protected] <[email protected]>
wrote:

> in the perform method I am setting the run.setResult(Result.FAILURE) […]
> This does not fail the Pipeline job instantly but it executes the next
> stage in the job.
>

Indeed. Do not call `setResult`. Throw an exception—`AbortException` if
nothing in Jenkins is broken and this is just a routine build failure.

https://javadoc.jenkins.io/jenkins/tasks/SimpleBuildStep.html#perform-hudson.model.Run-hudson.FilePath-hudson.EnvVars-hudson.Launcher-hudson.model.TaskListener-

(The one case where `setResult` is sometimes used is with `UNSTABLE`, to
explicitly proceed with the build while marking it as yellow. Even this is
not generally a good idea; better to use
https://javadoc.jenkins.io/plugin/workflow-api/org/jenkinsci/plugins/workflow/actions/WarningAction.html
to be targeted. `JUnitResultsStepExecution` does both.)

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" 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-dev/CANfRfr3-6Lnnt_X%2BzTsJVPC6CmJ6bJG%3Du1DPtXjX-Fv-00Go6Q%40mail.gmail.com.

Reply via email to