How to fix unstable builds when thresholds are met?

余生长醉 提交于 2019-12-11 01:32:50

问题


My overall coverage is meeting the threshold, but still build is marked as Unstable. Does anyone know the reason for this?

16:53:04 [JaCoCo plugin] Thresholds: JacocoHealthReportThresholds [minClass=75, maxClass=99, minMethod=75, maxMethod=99, minLine=75, maxLine=99, minBranch=40, maxBranch=99, minInstruction=65, maxInstruction=99, minComplexity=0, maxComplexity=99]
16:53:04 [JaCoCo plugin] Publishing the results..
16:53:04 [JaCoCo plugin] Loading packages..
16:53:04 [JaCoCo plugin] Done.
16:53:04 [JaCoCo plugin] Overall coverage: class: 89, method: 89, line: 77, branch: 41, instruction: 67
16:53:04 [JaCoCo plugin] Health thresholds: JacocoHealthReportThresholds [minClass=75, maxClass=99, minMethod=75, maxMethod=99, minLine=75, maxLine=99, minBranch=40, maxBranch=99, minInstruction=65, maxInstruction=99, minComplexity=0, maxComplexity=99]
16:53:04 [JaCoCo plugin] Apply Min/Max thresholds result: UNSTABLE

Jacoco report


回答1:


Ok, according to links I found, the coverage should be ABOVE both minimum and maximum coverage.

See the links https://issues.jenkins-ci.org/browse/JENKINS-16903 — reporting the same unexpected behaviour.

https://groups.google.com/forum/#!topic/jenkins-jacoco-plugin-mailing-list/pzHm98RJjB8/discussion — here the rule it is finally declared:

The configured maximum thresholds are above the actual coverage. If a coverage is below minimum the build fails, if the coverage is below maximum the build is unstable, if it is above then it is a success.

It also seems from the second topic that specifying only one threshold (or only minimum) does not work. Therefore I'd recommend you to try setting both min and max to your expected minimum.




回答2:


Unstable build is fixed by adding below config.

10:43:30 [JaCoCo plugin] Overall coverage: class: 89, method: 89, line: 77, branch: 41, instruction: 67 10:43:30 [JaCoCo plugin] Health thresholds: JacocoHealthReportThresholds [minClass=30, maxClass=75, minMethod=30, maxMethod=75, minLine=30, maxLine=75, minBranch=30, maxBranch=40, minInstruction=30, maxInstruction=65, minComplexity=30, maxComplexity=49] 10:43:30 [JaCoCo plugin] Apply Min/Max thresholds result: SUCCESS

P.S my actual Coverage complexity is 50



来源:https://stackoverflow.com/questions/57060237/how-to-fix-unstable-builds-when-thresholds-are-met

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