bjo*_*nen 3 jenkins jenkins-plugins
我有一个带有 recordIssues 步骤的简单 Jenkinsfile。相关代码如下所示:
step([
$class: 'recordIssues',
aggregatingResults: true,
enabledForFailure: true,
tools: [pyLint()]
])
Run Code Online (Sandbox Code Playgroud)
我已经安装了最新版本的警告下一代插件 ( https://plugins.jenkins.io/warnings-ng ),但我遇到了以下问题:
[Pipeline] step
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.UnsupportedOperationException: no known implementation of interface jenkins.tasks.SimpleBuildStep is named recordIssues
at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:478)
Run Code Online (Sandbox Code Playgroud)
是否可以以某种方式检查扩展是否正确安装?
这是我在 Jenkins 中使用 JUnit、PEP8、Pylint 和 Coverage 报告的 Python 项目 CI 配置的工作版本:
...
stage('Test: Run') {
steps {
// Run my project tests.
sh 'coverage run manage.py tests'
// Dump coverage metrics to XML.
sh 'coverage xml'
// Run Pylint.
sh 'pylint --rcfile=.pylintrc my_project > reports/pylint.report'
// Run Pycodestyle (PEP8 checks).
sh 'pycodestyle my_project > reports/pep8.report'
}
post {
always{
// Generate JUnit, PEP8, Pylint and Coverage reports.
junit 'reports/*junit.xml'
recordIssues(
tool: pep8(pattern: 'reports/pep8.report'),
unstableTotalAll: 200,
failedTotalAll: 220
)
recordIssues(
tool: pyLint(pattern: 'reports/pylint.report'),
unstableTotalAll: 20,
failedTotalAll: 30
)
cobertura coberturaReportFile: 'reports/coverage.xml'
}
}
}
...
Run Code Online (Sandbox Code Playgroud)
它适用于Cobertura 插件、JUnit 插件和下一代警告。我使用的 Python 包是传统的coverage和pylint,对于 PEP8,我使用了pycodestyle。
希望这对其他人有所帮助,因为找到这些Jenkinsfile东西的好例子并不容易。
| 归档时间: |
|
| 查看次数: |
3512 次 |
| 最近记录: |