griddynamics / mpl

[IT-36925] Jenkins Shared Modular Pipeline Library
https://blog.griddynamics.com/developing-a-modular-pipeline-library-to-improve-devops-collaboration/
Apache License 2.0
158 stars 97 forks source link

FlowInterruptedException should not be wrapped #33

Closed sdkrach closed 5 years ago

sdkrach commented 5 years ago

Currently, all exceptions which occur during module execution are wrapped inside a MPLModuleException. Unfortunately, this also occurs for org.jenkinsci.plugins.workflow.steps.FlowInterruptedException which is used by Jenkins to abort a running build (e. g. manually aborted by the user or timeouts). Since the exception which is caught in the end by Jenkins is of a different type as expected, Jenkins interprets it as a build failure.

An excerpt of a current log file with an timeout occuring during build:

[Pipeline] End of Pipeline com.griddynamics.devops.mpl.MPLModuleException: Found error during execution of the module 'library:MDSD.tools Lib/resources/tools/mdsd/devops/pipeline/stages/impl/constraintBuild/modules/Build/Build.groovy': org.jenkinsci.plugins.workflow.steps.FlowInterruptedException Finished: FAILURE

when the exception is not wrapped the log looks like:

[Pipeline] End of Pipeline Timeout has been exceeded Finished: ABORTED`

sparshev commented 5 years ago

Yeah, I think it's a good point - thank you for the contribution)