Hello! I'm working on a project to display the results of Jenkins builds in 
an external dashboard, and I've run into a fun conceptual problem.

I'd like to tell if a BuildStep had a good or bad outcome. A 'good' outcome 
is one in which the step executed as expected, while a 'bad' outcome is one 
in which somebody should probably take a look at the build to see what's 
wrong with it. For instance, if an Execute Shell command exited with return 
code 0, that's good; if it exited with return code 1, that's bad. 
Similarly, if a "Publish JUnit test result report" reports all tests 
passed, that's good, and if some tests failed, that's bad.

Currently I'm guessing the outcome of steps by heuristics: If the BuildStep 
made the build result worse, as reported by AbstractBuild#getResult, then 
we say the step had a bad outcome. If the BuildStep requests the step abort 
(that is, from our StepNotifier we see canContinue = false), the step had a 
bad outcome. And so on.

But such heuristics will still be wrong sometimes. Say one post-build 
action notices a test failed, and marks the build as unstable. Then a 
second post-build action notices another test failed. Since the build was 
already unstable, my plugin can't tell that the second action had a bad 
outcome; it didn't make the build's result any worse.

Of course, I can add more heuristics. (For instance, here I can hook into 
test result reporting, and say an action had a bad outcome if it reported 
some failing tests.) But I'll always guess wrong in some case. Is there a 
more general way to tell whether a step had a good or bad outcome?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/a1578804-6fa2-457e-b17b-14a9522e3609%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to