I currently have separate perf tests running as 4 jenkins stages. Currently if a perf test fails the entire pipeline fails. I can mitigate this by wrapping in a try catch which will let me continue, but will mark the stage as a success when it has actually failed. I'd like to get a red failure box for the stage that has failed, and allow the other stages to run. I'm not worried if Jenkins marks the entire job as a failure, so long as the stage that failed is highlighted and doesn't prevent other stages from running.
Have a look here Show a Jenkins pipeline stage as failed without failing the whole job
Note that you have a choice whether to mark the whole job as failed or not, but most importantly all stages are done regardless while marking those that failed.
I think this is a duplicate question, but I can't link the questions.
This is not possible. Stages can only run if preceding stages pass.
One thing you could do that would have a similar effect is to run four jobs in parallel in the same stage. I don't know if you currently use the blue ocean UI, but it shows each job in a stage in a separate little circle, and if one fails, it is very obvious which one failed (very much like the classic pipeline UI where you can tell exactly which stage failed).
There's some pictures of what I'm talking about at https://jenkins.io/blog/2016/05/26/introducing-blue-ocean/, including this.
To ignore test phase failure, we can add below parameter under maven goals in jenkins
clean install -PDEV Dmaven.test.failure.ignore=true
Answer to my own question:
Wrap the stage in question in a try/catch or catchError
catchError{
stage("stage"){
// command
}
}
The pipeline will continue but the stage will be marked as failure/red in the GUI and the rest of the job will continue.
© 2022 - 2024 — McMap. All rights reserved.