There is no way to catch a failing block, mark it as "failed" with a user defined description and continue execution of the Pipeline.
In the example below, the Optional Tests stage would always be successful.
Introduce new steps that can set the state of the stage to UNSTABLE, FAILED, SUCCESS, ABORTED. The message specified would be visible on the UI in Blue Ocean.
- There is precedence here with the error signal step.
- To ensure consistency the FAILED state should always fail the pipeline.
- The UNSTABLE state is used by tests to mark a stage as problematic but allows execution of the Pipeline to continue.
- Unstable should be expanded to handle the case where the intent of the Pipeline author is to record that there was a problem with the execution of the stage but execution is allowed to continue.
I recently discovered that pipeline stages that are run in parallel which report different results from one another are not currently being displayed correctly in the Blue Ocean UI. Here is a short snippet of code that reproduces the problem case I found:
Here I expect that 2 dummy test suites will be executed, one containing important tests that must all pass, and another containing less important tests that may be allowed to fail. Following these 2 parallel test stages is a final deploy stage that would be run afterwards so long as the "important" tests complete successfully.
In this example I'd expect that the node in the pipeline graph for the 'testB' stage would show up red while the other 2 nodes would show up green. Currently this does not happen - all 3 stages show up as green. I've attached a sample screenshot to illustrate the results.
It is also worth mentioning that the statuses of these stages does appear to be represented correctly in the old 'stage view' from the default Jenkins UI. I've attached a screenshot illustrating this as well.