如何正确使用Jenkins Warnings Next Generation Plugin的三个步骤?
How to use the three steps of Jenkins Warnings Next Generation Plugin properly?
Jenkins 警告下一代插件的 documentation 管道指定了三个步骤变体:
publishIssues
:发布由静态分析扫描创建的问题
recordIssues
:记录编译警告和静态分析结果
scanForIssues
:扫描文件或控制台日志以查找警告或问题
我刚刚尝试了这个简单的片段:
stage('QA checks') {
steps {
recordIssues([
enabledForFailure: true,
tools: [php()]
])
}
}
并在构建页面上显示结果 ("PHP Runtime: No warnings")。但是另外两步的意义是什么?
配置插件的正确方法是什么?这三部分要不要这样用?
stage('QA checks') {
steps {
scanForIssues([...])
recordIssues([...])
publishIssues([...])
}
}
为了同样的问题来到这里。从文档中找出来。 https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md
总而言之,recordIssues
命令旨在单独用于简单的用例,而 scanForIssues
和 publishIssues
命令旨在一起用于更复杂的用例。
所以您对 recordIssues
的用法似乎完全符合作者的意图。
Advanced Pipeline configuration
Sometimes publishing and reporting issues using a single step is not
sufficient. E.g., if you build your product using several parallel
steps and you want to combine the issues from all of these steps into
a single result. Then you need to split scanning and aggregation. The
plugin provides the following two steps:
scanForIssues
: this step scans a report file or the console log with a particular parser and creates an intermediate
AnnotatedReport
object that contains the report. [...]
publishIssues
: this step publishes a new report in your build that contains the aggregated results of several scanForIssues steps. [...]
作为已接受答案的补充,可能还有一些关于如何使用插件的内容。
官方Jenkins step documentation is also a great place to have a look on the Warnings NG plugin. The following examples are from the Warnings NG Github repo.
publishIssues: Publish issues created by a static analysis scan
publishIssues issues: [checkstyle]
recordIssues: Record compiler warnings and static analysis results
recordIssues enabledForFailure: true, aggregatingResults: true, tool: checkStyle(pattern: 'checkstyle-result.xml')
scanForIssues: Scan files or the console log for warnings or issues
scanForIssues tool: checkStyle(pattern: '**/target/checkstyle-result.xml')
以下示例应显示 scanForIssues
和 publishIssues
之间的区别。
sh "${mvnHome}/bin/mvn --batch-mode -V -U -e checkstyle:checkstyle pmd:pmd pmd:cpd findbugs:findbugs"
def checkstyle = scanForIssues tool: checkStyle(pattern: '**/target/checkstyle-result.xml')
publishIssues issues: [checkstyle]
Jenkins 警告下一代插件的 documentation 管道指定了三个步骤变体:
publishIssues
:发布由静态分析扫描创建的问题recordIssues
:记录编译警告和静态分析结果scanForIssues
:扫描文件或控制台日志以查找警告或问题
我刚刚尝试了这个简单的片段:
stage('QA checks') {
steps {
recordIssues([
enabledForFailure: true,
tools: [php()]
])
}
}
并在构建页面上显示结果 ("PHP Runtime: No warnings")。但是另外两步的意义是什么?
配置插件的正确方法是什么?这三部分要不要这样用?
stage('QA checks') {
steps {
scanForIssues([...])
recordIssues([...])
publishIssues([...])
}
}
为了同样的问题来到这里。从文档中找出来。 https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md
总而言之,recordIssues
命令旨在单独用于简单的用例,而 scanForIssues
和 publishIssues
命令旨在一起用于更复杂的用例。
所以您对 recordIssues
的用法似乎完全符合作者的意图。
Advanced Pipeline configuration
Sometimes publishing and reporting issues using a single step is not sufficient. E.g., if you build your product using several parallel steps and you want to combine the issues from all of these steps into a single result. Then you need to split scanning and aggregation. The plugin provides the following two steps:
scanForIssues
: this step scans a report file or the console log with a particular parser and creates an intermediate AnnotatedReport object that contains the report. [...]publishIssues
: this step publishes a new report in your build that contains the aggregated results of several scanForIssues steps. [...]
作为已接受答案的补充,可能还有一些关于如何使用插件的内容。
官方Jenkins step documentation is also a great place to have a look on the Warnings NG plugin. The following examples are from the Warnings NG Github repo.
publishIssues: Publish issues created by a static analysis scan
publishIssues issues: [checkstyle]
recordIssues: Record compiler warnings and static analysis results
recordIssues enabledForFailure: true, aggregatingResults: true, tool: checkStyle(pattern: 'checkstyle-result.xml')
scanForIssues: Scan files or the console log for warnings or issues
scanForIssues tool: checkStyle(pattern: '**/target/checkstyle-result.xml')
以下示例应显示 scanForIssues
和 publishIssues
之间的区别。
sh "${mvnHome}/bin/mvn --batch-mode -V -U -e checkstyle:checkstyle pmd:pmd pmd:cpd findbugs:findbugs"
def checkstyle = scanForIssues tool: checkStyle(pattern: '**/target/checkstyle-result.xml')
publishIssues issues: [checkstyle]