Jenkins – get the status of a previous stage build in Jenkins pipeline

Jenkinsjenkins-pipelinejenkins-workflow

I have a Jenkins job, that uses the pipeline mechanics. It has several steps. For understanding let's assume I have 3 stages. the first 2 run in parallel, the 3rd after them. Now depending on the result of the last build of stage 3 I want to do different thing.
If stage 3 was previously successful, I want the result from stage 1, otherwise take stage 2 result.
Is this possible to check? I don't get how to retrieve the last result of a stage, only did a similiar thing for last state of a job.

Best Answer

  1. Write output from only succesfull job, no need to check then
  2. I've not heard stage status, you've to break your stages into separate jobs and then use 'job status'