I noticed a strange behavior when using post actions for stages. It seems like the stage result for a post action is not considered if there is already a worse overall build result set.
According to the doc, the post success block should:
It rather looks like that it only runs the steps if the current pipeline status is SUCCESS or not set and the stage is also SUCCESS. If the stage is SUCCESS but not the pipeline status it would not be executed.
This seems very unintuitive because you would think that if a stage is successful, the success stage post action would also always be triggered. Therefore, the post actions for steps is actually not usable if the overall build result is set to e.g., UNSTABLE.
I added a small example where such a behavior can be seen:
Stage A is executed and the stage result as well as the pipeline result is then set to UNSTABLE. Afterwards stage B is executed. It is successful, but only the unstable post action of stage B is executed instead of its success stage.
I also found some issues which sound similar to my described problem, like
JENKINS-39203. But in my case it's only about the execution and not the visualization. There is also a comment at the end describing something similar....