【发布时间】:2020-07-21 23:37:03
【问题描述】:
在Jenkinsfile 中使用声明性管道语法并使用cobertura 发布覆盖率报告,如下所示
cobertura(
coberturaReportFile: 'coverage/cobertura-coverage.xml',
enableNewApi: true,
autoUpdateHealth: true,
autoUpdateStability: true,
failUnstable: true,
failUnhealthy: true,
failNoReports: true,
onlyStable: false
)
还尝试使用code coverage api,如下所示:
publishCoverage(
failUnhealthy: true,
calculateDiffForChangeRequests: true,
failBuildIfCoverageDecreasedInChangeRequest: true,
failNoReports: true,
adapters: [
coberturaAdapter(path: 'coverage/cobertura-coverage.xml')
]
)
查看我能找到的所有文档,如果不使用硬编码阈值,我无法找出 what are the instructions to fail the build if coverage drops。
希望能提供参考或代码 sn-p。
【问题讨论】:
标签: jenkins jenkins-pipeline jenkins-groovy cobertura