How to get the reuslt of downstream jobs if one of the downstream job failed


I have a job that has two stages. The first one is to build artifacts and the other one is to run two paralleled jobs. I wish I could get the result of these two paralleled jobs and then write some logic according to the result. The problem is I can get the result if these two jobs passed, however, I could not get the result if one of them failed.

Here is an example/test I have written:
result-test is the upstream job
test1 and test2 are these two paralleled jobs

Map set_test = [failFast: false]

set_test[‘set’] = {build job:‘test1’}
set_test[‘test’] = {build job:‘test2’}


def result
result = parallel(set_test)
println(“set result”: +result[‘set’].getResult())
println(“test result”: +result[‘test’].getResult())
println(“set result”: +result[‘set’].getResult())
println(“test result”: +result[‘test’].getResult())

Senario1: test1 and test2 passed
pipeline output:

Senario1: test1 and test2 failed
pipeline output:
The value of result if null

1 Like

You probably need to use propagate: false on the build “steps”. When one of the steps in the parallel fails the assignment to the “result” variable is not executed anymore.
You will then need own logic to make the job fail if any of the triggered jobs failed.

1 Like

Hi mawinter69,
Thanks for your reply. Added propagate: false could get both results of downstream jobs. Just noticed that these two downstream job are failfast : false in my posted code. However I wish to have it as failfast : true in the first place. Sorry about that. And it seems that the post is posted too long I can’t edit it anymore.

So with failfast : true, the propagate: false will igrone failfast : true. So In my case, if both jobs (setup & test) are added propagate: false, it is kind of like using failfast : false. However, I can’t wait for both of them to be completed because if the setup job failed, the test job will not get the nodes to run which means it never ends.

Hi @halkeye

Could you close this one and reopen the one you just closed?

These two topics are quite different with failfast ture/false. I wanted to edit this post few days ago but it show this post have posted too long to edit it.