Running following code:
Only step in Build stage fails, declarative plugin adds extra print step to print there was failure however this step is not marked as error resulting in failure to mark the stage as error using StatusAndTiming.computeChunkStatus() api, which reports status of stage based on last step. That is if last sep was success, that means all is well. Sam Van Oort, this also shows up 'Build' stage as success in stage view plugin.
Intent of declarative plugin is to report error that running that stage failed, this extra step it injects should have step.getError() return an error, that is FlowNode.getError().getError() returns a well known throwable to identify stage failed to run, StageExecutionFailure or something like that? Otherwise it defeats the purpose of marking stage as failure using StatusAndTiming.computeChunkStatus() API.