[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at BUILD level /home/jenkins/workspace/awesome-integration-into-jenkins/mochawesome-report to
/var/jenkins_home/jobs/IDE/jobs/ide-application/branches/subtask-I.anjt14c4kifi.o-jenkins/builds/5/htmlreports/Mochawesome_20Report
This output is obtained after running:
post {
always {
sh 'rm mochawesome-report/mochawesome.json'
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: "$WORKSPACE/mochawesome-report/",
reportFiles: 'mochawesome.html',
reportName: "Mochawesome Report"
])
cleanWs()
}
}
I am using htmlpublisher to publish test report after all steps in the pipeline are complete. As can be seen from the output, the files are copied to var/jenkins_home/jobs/IDE/jobs/mosaiq-ide-application/branches/subtask-I.anjt14c4kifi.o-jenkins/builds/BUILDNUMBER/. There is no setting in htmlpublisher that allows the user to delete old report folders. Is there a plugin that I can use in the post pipeline step that looks inside the ..../builds/BuildNumber/htmlreports folder and checks if it is x days old, and removes it. Or how can I efficiently achieve the desired result?