1

I am stuck in peculiar problem. I have a complex Jenkins pipeline with multiple stages running in parallel. Each stage is wrapped in a catchError block, so that all stages run irrespective of results. I want to capture the results of individual stage results and write them to the particular environment variable. And send them to html email template where the stage names and results and posted.

Problem: Consider there are three stages, Stage A, Stage B and Stage C running in parallel. I tried currentBuild.result and currentBuild.currentresult. It worked fine when all the stages passed. But in below condition. Stage C fails first, value of currentBuild goes to failure. Even though Stage A and Stage B gets passed their results are being shown as Failure. Because of the parallel execution and race condition. Any other way to get stage results when they run in parallel?

I tried above logic, it failed due to race condition as they don't execute in sequential way, the results get's influenced by failure in any of the stages. Any help will be much appreciated!

braX
  • 11,506
  • 5
  • 20
  • 33

0 Answers0