Jenkins html发布功能:发布所有文件,包括不 html 的文件

Jenkins htmlPublish function : All files are published including not html ones

我想发布 html 个文件,有可能在我的文件夹中有不止一个文件,因此我定义了如下函数:

dir("${WORKSPACE}/reports/${testScope}-${team}") {
      unstash "${testScope}-${team}-test-report"
      htmlFiles = findFiles glob: '*.html'
    }
    publishHTML(target: [
        allowMissing         : false,
        alwaysLinkToLastBuild: true,
        keepAll              : true,
        reportDir            : "${WORKSPACE}/reports/${testScope}-${team}/test/results/report/",
        reportFiles          :  htmlFiles.join(','),
        reportName           : "${testScope}-${team}",
        reportTitles         : "${testScope} ${team} Test report"
    ])
    

这会发布我文件夹中的所有文件,甚至 xml 个文件,我的代码有问题吗?

如何调整这个答案:

publishHTML([
  reportName: 'Newman Report'
  reportDir: 'reports',
  reportFiles: "${dir('reports') { findFiles(glob: '**/*.html').join(',') ?: 'Not found' }}",
  allowMissing: true,
  alwaysLinkToLastBuild: true,
  keepAll: true,
])

dir() 闭包 直接在 G-string 内部使用作为赋值给参数 reportFiles .