我正在尝试通过 Jenkinsfile 为 Jenkins 配置 HTML Publisher 插件来发布一些 html 文件,如下所示:
publishHTML(
target: [
allowMissing : false,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : 'my-project-grails/build/reports/codenarc',
reportFiles : 'test.html',
reportName : "Codenarc Report"
]
)
的描述reportFiles
范围here https://jenkins.io/doc/pipeline/steps/htmlpublisher/说我应该能够指定多个文件。但语法是什么?
如果你有多个 HTML 文件,但不知道它们的名称,也不提前计数,你可以这样做:
script {
def htmlFiles
dir ('reports') {
htmlFiles = findFiles glob: '*.html'
}
publishHTML([
reportDir: 'reports',
reportFiles: htmlFiles.join(','),
reportName: 'Newman Collection Results',
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true])
}
注意script
部分,因为 Jenkins 不允许在中声明变量stage
or steps
部分。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)