Continue Jenkins job after failed stage while marking stage as failed

安稳与你 提交于 2020-01-05 07:19:13

问题


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.


回答1:


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.




回答2:


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.




回答3:


To ignore test phase failure, we can add below parameter under maven goals in jenkins

clean install -PDEV Dmaven.test.failure.ignore=true


来源:https://stackoverflow.com/questions/45223159/continue-jenkins-job-after-failed-stage-while-marking-stage-as-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!