code-coverage-api-plugin icon indicating copy to clipboard operation
code-coverage-api-plugin copied to clipboard

failNoReport, failUnstable, failUnhealthy, etc fail the build, but not the stage

Open Cetlan opened this issue 4 years ago • 1 comments

Unless I've missed a possible setting somewhere, it looks like the settings to tell the coverage report to fail a build if the coverage metrics fail do fail the build, but don't flag the stage as failed. This means that by glancing at the pipeline display you can't tell that it was the coverage tests that failed. However the state is being handled, it seems to be outside the pipeline error/state handling since I don't seem to be able to override this behaviour with catchError/warnError/etc either.

Cetlan avatar Oct 15 '20 04:10 Cetlan

From https://issues.jenkins-ci.org/browse/JENKINS-39203 it looks like that the new API has not been implemented here yet.

uhafner avatar Oct 15 '20 22:10 uhafner

The new step recordCoverage is now in beta testing, can you please check if this release helps to solve this issue? Please note that the syntax of the step is totally new and cannot be combined with existing results.

uhafner avatar Mar 15 '23 21:03 uhafner

Thanks. I set up a simple Jenkins server to git it a quick look. The new step solves exactly what I was missing when I filed this - I now can see a coverage check stage/post stage failed in the pipeline overview if the coverage threshold isn't hit. I didn't check the unstable status, github checks, etc, but I assume they work if the failure report does.

I did notice a difference in the report generated between the old and new steps - but I'm not sure if that's because I missed something or whether it's because my test code was pretty limited or if it's actually a change (branch coverage tab was missing).

I can give it a check in a more production-like environment when I can get time to upgrade our backup Jenkins server at work (it's just a bit too outdated to run the new coverage plugin, so might take a bit of time to do that), but at a glance I'd say this was exactly what I was looking for.

Cetlan avatar Mar 16 '23 02:03 Cetlan