Before this change there was no such thing as a stage result (and technically with recent changes there still isn't, we just have step results that are aggregated at the stage level). There was no way to make existing code that deals with results use the new step result API transparently, so we still need to be able to handle anything setting the overall build result or throwing an exception (if the current build result is UNSTABLE, but the stage threw an exception (which doesn't change the build result directly), we only want to run the FAILURE post condition, not the UNSTABLE one, hence BuildCondition.combineResults), unless we make post blocks only work for catchError, unstable, and warnError, and the few other steps that are using the new API, but that would break many (maybe most?) existing use cases, especially around things like currentBuild.result, which is and always will be oblivious to the new step-level API. |