1

在我的 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-reports\201612081633。最后一部分201612081633当然每次都不一样。在 Windows 机器上使用target/pit-reports/*/会导致以下错误。

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

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

4

1 回答 1

1

我使用解决方法解决了这个问题,因为 publishHTML 插件似乎无法处理***. 我现在运行 ptest with -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上找到。

于 2017-01-11T12:14:12.903 回答