Few days ago i asked in http://www.stackoverflow.com this question:
I wanted to get the result of the upstream job depending on the result of the downstream jobs. I mean:
If in the upstream job i get a “stable” result but if in one of the downstream jobs i get an “unstable” or “failed” result i want to get the worst status in my upstream job.
In my case, i wanted to speed up the test execution paralellizing the build in different downstream jobs, therefore, i wanted to have the overall result of the build in the main job (the upstream) in order to see the result of the complete build in a single point.
I couldn’t find any good solution, only workarounds. So i started to investigate and discovered the best Jenkins / Hudson plugin i have ever seen: the Groovy Postbuild plugin
With this plugin you can do almost whatever you want with Jenkins / Hudson. It allows you to execute a Groovy script in the post build phase and offers you the “build” and “hudson” Java objects.
The solution for my problem was a simple Groovy script added in the downstream jobs. This code gets the upstream job, access to the last build, check the result and if its result is better than the downstream one, it updates it.
This is the piece of code: