Mule - 当代码覆盖率小于预定义阈值时,如何使 jenkins 管道失败?
我用 Munits 构建了一个 Mule API。我想使用詹金斯管道构建和部署应用程序。然而,在构建之前,部署,我想执行 Maven clean 测试并检查代码覆盖率是否小于某个 x%。如果是,那么我想让 Mule 云中心的构建/部署失败。
当代码覆盖率低于预定义的阈值(比方说 80%)时,是否有 Jenkins 插件或任何选项可以使 jenkins 管道失败?
谢谢, 巴拉
I have a built a Mule API with Munits. I would like to build and deploy the application using jenkins pipeline. However, before build & deploy, I would like to execute maven clean test and check if code coverage is less than some x%. if yes, then I would like to fail the build/deployment to Mule cloud hub.
Is there a Jenkins plugin or any option to fail the jenkins pipeline when the code coverage is less than pre-defined threshold (let's say 80%)?
Thanks,
Bala
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来该主题已在 Maven 中的 MUnit 文档中进行了介绍:
如果将适当的阈值(例如 requiredApplicationCoverage)设置为所需的值,并且覆盖率不够高,则 Maven 测试阶段将失败。由于 Jenkins 只执行 Maven,它也会失败。
Looks like the topic is covered in MUnit documentation for coverage in Maven:
If you set the appropriate threshold (for example requiredApplicationCoverage) to the desired value it will fail the Maven test phase if coverage is not high enough. Since Jenkins just executes Maven it will fail too.