-
Bug
-
Resolution: Duplicate
-
Minor
-
Jenkins 2.233
Pipeline Build Step: 2.12
Currently, when using build and the invoked build fails, a FlowInterruptedException(null) is thrown. This exception has a null message and cause. Additional acrobatics are necessary to add something informative in the invoking build (ie calling handle() with a listener or switching to propagate: false and interrogating the resulting object).
This is especially inconvenient when a pipeline triggers multiple builds, as it is not easy to determine which one failed (even worse when using parallel).
My current workaround is to use my own shared var wrapper instead of build:
/** * same as DSL's "build", but produces a neat exception on failure that we can actually use * (as opposed to a FlowInterruptedException(null)) */ def buildAndWait(Map config) { def buildResult = build(config + [propagate: false]) if (buildResult.resultIsWorseOrEqualTo('UNSTABLE')) { error "Build ${buildResult.projectName}#${buildResult.number}: ${buildResult.result}" } }
Ideally, build would throw a more informative exception so that I don't need the above.
I am using exceptions in my scripted pipelines to drive automatic notifications, and, since many different parts of the build can fail, it's very helpful to know at a glance what the cause was.
- duplicates
-
JENKINS-60478 When job fails, stack trace is Null
- Open