jenkins: Enable Cobertura failing for code coverage

Measure code coverage "by line" (Go actually measures by block, but whatever)
The '100, 0, 0' means anything above 100 auto-passes, anything below 0 auto-fails,
and anything below 0 is reported as unstable. autoupdateHealth, if I understand
correctly, will raise the functional auto-fail limit each time, so that a drop
in coverage will result in a failed test.  Finally failUnhealty is the trigger
which actually causes the build to fail, rather than simply reporting an error.

I have tested these changes using replay, but I was unable to verify 100% that
they work as designed.  The risks of having to revert this code seems less than
the cost of spending more time playing around with Jenkins locally..

Change-Id: Ica855b36aef7e1c3023fa80611229ca691017021
This commit is contained in:
Bill Thorp 2020-05-13 10:39:18 -04:00 committed by Egon Elbre
parent 4d0cb1af7e
commit 3aa3732b0d

View File

@ -87,7 +87,10 @@ pipeline {
sh script: 'filter-cover-profile < .build/coverprofile > .build/clean.coverprofile', returnStatus: true
sh script: 'gocov convert .build/clean.coverprofile > .build/cover.json', returnStatus: true
sh script: 'gocov-xml < .build/cover.json > .build/cobertura.xml', returnStatus: true
cobertura coberturaReportFile: '.build/cobertura.xml'
cobertura coberturaReportFile: '.build/cobertura.xml',
lineCoverageTargets: '100, 0, 0',
autoUpdateHealth: true,
failUnhealthy: true
}
}
}