In my Jenkinsfile I use publishHTML to publish report for PIT. My step is as follows
stage('Results') {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false,
keepAll: false, reportDir: 'target/pit-reports/*/', reportFiles: 'index.html', reportName: 'PIT Report'])
}
The directory of the index.html is something like this \target\pit-reports\201612081633
. That last part 201612081633
is of course different every time. Using target/pit-reports/*/
on a windows machine results in the following error.
ERROR: Specified HTML directory 'D:\David\Tools\Jenkins\workspace\jenkinsSandbox\target\pit-reports\*' does not exist.
The wildcard *
or **
does not work. How can I use a wildcard for a directory name in the jenkinsfile and is there any difference when doing this on windows or unix?
I solved this using a workaround because the publishHTML plugin seems to be unable to handle *
or **
. I now run pitest with -DtimestampedReports=false org.pitest:pitest-maven:mutationCoverage
, which disables the timestamped folders. The result step now looks like this.
stage('Results') {
publishHTML([allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'target/pit-reports',
reportFiles: 'index.html',
reportName: 'PIT Report'
])
}
For those who are interested, the full version of my Jenkinsfile can be found on my github repo.