无法识别使用 publishHTML 的 Jenkinsfile 中目录名称的通配符

Wildcard for directory name in Jenkinsfile using publishHTML not recognized

在我的 Jenkinsfile 中,我使用 publishHTML 发布 PIT 的报告。我的步骤如下

stage('Results') {
  publishHTML([allowMissing: false, alwaysLinkToLastBuild: false,
     keepAll: false, reportDir: 'target/pit-reports/*/', reportFiles: 'index.html', reportName: 'PIT Report'])
}

index.html的目录是这样的\target\pit-reports1612081633。最后一部分 201612081633 当然每次都不一样。在 windows 机器上使用 target/pit-reports/*/ 会导致以下错误。

ERROR: Specified HTML directory 'D:\David\Tools\Jenkins\workspace\jenkinsSandbox\target\pit-reports\*' does not exist.

通配符 *** 不起作用。我如何在 jenkinsfile 中使用通配符作为目录名称,在 windows 或 unix 上执行此操作有什么区别?

我使用变通方法解决了这个问题,因为 publishHTML 插件似乎无法处理 ***。我现在 运行 使用 -DtimestampedReports=false org.pitest:pitest-maven:mutationCoverage 进行测试,这会禁用带时间戳的文件夹。结果步骤现在看起来像这样。

stage('Results') {
publishHTML([allowMissing: false,
             alwaysLinkToLastBuild: true,
             keepAll: true,
             reportDir: 'target/pit-reports',
             reportFiles: 'index.html',
             reportName: 'PIT Report'
             ])

}

对于那些感兴趣的人,我的 Jenkinsfile 的完整版本可以在我的 github repo.

上找到