Jenkins HTML publishing on build level without copies

1.5k views Asked by At

I am trying to publish HTML reports for each build. I tried plugin HtmlPublisher (1.22) but when it publishes my reports on their build page (using keepAll=true), it creates copies of reports from all previous builds in each build directory. So, each Jenkins build includes many copies of old reports and they are bigger and bigger. If I publish my reports on the project page (using keepAll=false), old reports are preserved in their project directory (in my file system) but only the last report is accessible from Jenkins. Is there any way how to have reports on their build pages without creation of their duplicates? Maybe, there is some parameter that I'm still missing.

My pipeline includes the following HtmlPublisher use:

publishHTML (target: [
  allowMissing: false,
  alwaysLinkToLastBuild: false,
  keepAll: true,
  reportDir: "./htmlReports",
  reportFiles: reportFileNames, //generic variable
  reportName: "Results"
])

EDIT: It seems that the publishHTML publishes the whole directory (reportDir) not the files (reportFiles). The files are used only for publishing wrapper (HTML generated by the publishHTML). So, when I generate my HTML artifacts to a shared directory for all builds, all files from this shared directory are copied to the build directory during publishing.

Is there way how I can publish only specific files without archiving all files in directory?

Thank you

1

There are 1 answers

0
Fenix On

I guess that copying of the whole directory is because of possible resources of published HTML pages. Therefore, all files are archived to (build/project) directory.

The htmlPublisher provides optional parameter includes which allows to specify the archived files.