Skip to end of metadata
Go to start of metadata

Plugin Information

View HTML Publisher on the plugin site for more information.

 

This plugin publishes HTML reports.

Starting in versions 1.625.3 and 1.641, Jenkins restricted what kind of content could be displayed when serving static files. This can impact how HTML files archived using this plugin are displayed. See Configuring Content Security Policy for more information.

Installation Steps:

1. Go to Jenkins Dashboard
2. Click on the link that says "Manage Jenkins"
3. On the Plugin Manager page, go to the "Available" tab next to Updates tab
4. Look for the html publisher plugin, select the checkbox and click install. Wait for it come back with status "Success".
5. Restart Jenkins by clicking the provided link on the success page, or if using tomcat, executing <tomcat-Jenkins>/bin/shutdown.sh and <tomcat-Jenkins>/bin/startup.sh

How to use HTML Publisher Plugin:

HtmlPublisher plugin is useful to publish the html reports that your build generates to the job and build pages. Below are the steps to publish and archive the HTML report files

1. Click on the Configure option for your Jenkins job.

2. In the post build portion, look for the Publish HTML Reports option and select the checkbox. See the screen shot below

Fill the path to the directory containing the html reports in the "HTML directory to archive" field. Specify the pages to display (default index.html); you can specify multiple comma-separated pages and each will be a tab on the report page. You can also specify titles for the report page that appears on the tab, by default, file name will be taken as title.  Finally, give a name in the Report Title field, which will be used to provide a link to the report. By default, only the most recent HTML report will be saved, but if you'd like to be able to view HTML reports for each past build, select "Keep past HTML reports."

Some time at HTML directory, you don't have to specify project name, but have to start one level below. For e.g. if your project name is "ABC" and if HTML files are at "ABC/report-output/html" then you have to specify just \test-output\html\.

3. After saving the configuration, run build once. The published HTML reports are available to view from within Jenkins with convenient links in the dashboard.

Version History

Version 1.16 (April 16th, 2018)

  • Fix security vulnerability
    Note: As a side effect of this change, the URLs and directory names of archived reports will change. If you have external links pointing to reports in Jenkins, they may need to be adapted.

Version 1.15 (March 28th, 2018)

  • White space in report name, directory, files, and titles configuration settings is now all trimmed. (JENKINS-47034)
  • Index page titles can now be passed in as a parameter for Freestyle builds (Part of JENKINS-44786)
  • Note: Currently the HTML Publisher plugin will resolve parameters passed in with pipeline builds. This is not considered best practice and therefore should be considered deprecated - resolving the parameter should be done via Groovy. The current behaviour will be removed in a future release but will only create a warning in this release. 

Version 1.14 (July 7th, 2017)

  • Allow user to set file includes pattern (PR-25)

Version 1.13 (April 18th, 2017)

  • Allow specifying tab titles for report files (PR-27)

Version 1.12 (January 6th, 2017)

  • Fix "PublishHTMLStepExecution.run can block CPS thread" (JENKINS-40447)

Version 1.11 (February 4th, 2016)

Version 1.10 (December 13th, 2015)

Version 1.9 (November 4th, 2015)

  • added wrapperName field to maintain serialization compatibility. (JENKINS-31366)

Version 1.8 (October 18th, 2015)

Version 1.7 (October 16th, 2015)

  • Support FileSet includes (ant patterns) for report files (JENKINS-7139) (reverted in 1.8)

Version 1.6 (August 23rd, 2015)

Version 1.5 (July 26th, 2015)

  • Clean up / improve the configuration UI
  • Restore removed constructor in 1.4 to fix binary compatibility (JENKINS-29626)

Version 1.4 (May 24th, 2015)

  • Add an option to publish HTML reports even if the build fails. (JENKINS-11689, JENKINS-24057)

Version 1.3 (Nov 13th, 2013)

  • Add an option to allow a build not to fail if a report is not present
  • fix "html publisher plugin overrides report encoding with iso-8859-1" JENKINS-19268

Version 1.2 (Dec 10th, 2012)

  • revert "support Ant patterns in archive directory" to fix JENKINS-16083

Version 1.1 (Dec 7th, 2012)

  • support Ant patterns in archive directory (reverted in 1.2)
  • fix viewing HTML report for specific builds (12967@issue)
  • fix NPE (14491@issue)

Version 1.0 (May 10th, 2012)

  • Support environment variables when configuring the report directory and index pages (10273@issue)

Version 0.8 (Apr 26th, 2012)

  • Add empty descriptor to HtmlPublisherTarget (JENKINS-12258)
  • Scrollbar in HTML publisher due to 100% height on div/iframe (JENKINS-13070)
  • HTML Publisher does not work for multi-configuration projects (JENKINS-8832)

Version 0.7 (Aug 2nd, 2011)

  • Update to work with Jenkins 1.418+

Version 0.6 (Jan 20th, 2011)

  • Added Zip option to HTML Report View - this will provide a Zip file of the contents of the particular report (JENKINS-8163)

Version 0.5 (Jan 20th, 2011)

  • This version unintentionally left blank (smile)

Version 0.4 (May 24th, 2010)

  • The "Back to Jenkins" link is now "Back to JOBNAME" and goes back to the job instead of the Jenkins root (JENKINS-6521)

Version 0.3 (May 10th, 2010)

  • display per-build report links after a restart (only works for builds after the upgrade, alas) (JENKINS-5775)
  • don't display report links if there aren't reports yet (JENKINS-5683)
  • "Back to Jenkins" link triggers a back action in the browser if the user hasn't configured the Jenkins URL (JENKINS-6434)

Version 0.2.2 (Feb 17th, 2010)

  • Show all project-level reports on the project page, not just the first (JENKINS-5069)

Version 0.1.0

  • Initial release from abstraction of NCover plugin, allowing for archiving and displaying of HTML report directories

54 Comments

  1. Unknown User (s0473056@sbox.tugraz.at)

    Hi,

    I am archiving the results of a Hudson job run according to the Job'sName and BuildNumber.

    For that I'm using the environmental variables %JOB_NAME% and %BUILD_NUMBER%.

    Is it possible to use this variables into the path of the .html file in "HTML directory to archive"?

    For example C:\MyResults%JOB_NAME%_%BUILD_NUMBER%

    Thanks

    1. I have exactly the same problem. I don't know a  workaround to that. There is an issue for this: https://issues.jenkins-ci.org/browse/JENKINS-10273&nbsp;

      I vote for the fix

      1. I would need the same. My case: I have ant properties file and I would like to reuse the variables in the job (there is a EnvInject plugin for this) like in the Html Publisher plugin but the latter doesn't accept them.

        +1 vote :-)

        1. +1

          This is essential! I can't believe this plugin is not supporting that!

          1. This should be working in 1.0, please give it a shot.

  2. This plugin and the DocLinks Plugin basically seem to do the same. Wouldn't it be smart to merge them? Or is one of them more up-to-date?

  3. The HTML reports don't seem to be published on the build if the build is marked as unstable.  It updates the job's HTML report, but doesn't seem to attach the report to the build.  Is there a workaround for this?

    <note:  Never mind, either myself or a teammate had unchecked 'Keep past HTML reports'>

  4. This plugin is very good, very useful, 

    One thing I want to say is that, when click "back to " link in the html report page, it will return to the project page, could it return to the corresponding build page according to the build number?

    i want to modify it myself, but I don't know how to do it. 

    Hope one day I could modify it as my will.

  5. One more thing, 

    When the HTML report page also contain the Jenkins's header, slider and the foot page? so that the report will seems very good looking with Jenkins.

    Maybe I should do it myself, because others maybe don't like this,  but I don't know how to modify the content in the class file. I can change the code in java file, but i don't know how to compile it into java file.

    Anyone can help with this ?  

    thanks very much.

  6. I am using the groovy and jelly templates to send out build notifications. Is it possible in Jenkins to email out this HTML report along with the build status?

    1. This question isn't related to the HTML Publisher plugin and is perhaps better suited the Jenkins users mailing list, but you can likely do this. Either just use Groovy to read the contents of the HTML file and inject it into the email, or use something like the EnvInject plugin to inject the HTML into an environment variable and use it from your template.

  7. Hi,

    Can the plugin support wildcard *.html instead of specifying the name for every html?

    Max

    1. It does not currently, though this is https://issues.jenkins-ci.org/browse/JENKINS-7139, which in the comments has a couple suggestions for workarounds.

  8. I am using Jenking to run my selenium scripts on a remote server. My question is "Is there any way to visually see my scripts running on the server? I mean on an actual browser when scripts are running in Jenkins?"

  9. User abdurrahaman duwila added two html attachments containing malware to this page. I could find no place to report this on Wiki. I post it here just to warn the others. 

    Should be there an e-mail to send complaints to?

  10. I've setup the plugin and it is copying my reports that I am pointing it to but the links are not working. None of them.

    I have my buildsdir configured to someplace other than Jenkins/Jobs  do you not look at the setting for that and only use Jenkins/Jobs? 

    1. Solved the issue.  Filename had a typo in it. (head firmly slapped!)

  11. After upgrade Jenkins to ver. 1.528 HTML reports become unaccessible - and newly published as well:

    Status Code: 404

    1. Argh! Me too. No other changes on the CI box except for the Jenkins upgrade.

      1. Yes, seems to be a fundamental Jenkins problem with 1.528 and 1.529. The Doxygen plugin now has the same problem as well!

        1. Hey there, plugin author here. It was a Jenkins core bug that should be fixed in 1.530: https://issues.jenkins-ci.org/browse/JENKINS-19281. You can wait for its release or roll back to 1.527. Sorry about that!

  12. I'd like to be able to put my publish link (in my case "Build Artifacts") as a column in the Jenkins View.  Can you add support for this please?

  13. I would like to be able to specify where HTML publisher archive things: is there any way of doing this or a plan for that ?

    ( using a combination of HTML publisher + artifact deployer  where html publisher is just there to provide me with a nice looking link )

    thank you

    1. Hi Jerome! HTML Publisher is primarily for providing the link and serving the HTML, as you say. If you want the archive to end up elsewhere, I think you'd be best served by a build step that copies the HTML wherever you desire, or using a plugin as you mentioned. If you aren't keeping past HTML reports, you may also be able to symlink the report directory elsewhere if the desired destination is on the filesystem or otherwise mounted.

      1. Hi Michael

        the problem I have may then be linked to my setup

        I am using a slave Jenkins to run some tasks on a remote PC and then using HTML  publisher

        what I end up with after running HTML publisher is two copies of the output data of my tasks on the master Jenkins's workspace:  two directories "jobName/number/htmlReports" and "jobName/date/htmlReports"

        If I just use "artifactDeployer", I end up with a single directory "jobName/number" where I chose to put them, but I do not have my link.

        so it feels like "HTML publisher" is doing more than giving me a link and that is creating 2 copies of the data onto the master jenkins workspace

  14. Hello,

    a nice feature for the plugin would be an option to name a file (located in the report directory) to be used as icon for individual reports. This would allow to highlight reports that need more attention than others.

    Thank you for this useful plugin!

  15. Hi all,

    I'm having a strange behavior where the logs are created fine, but the link on the main Job's page shows old logs although the links in the individual builds pages are fine.
    Has anyone seen this or has an idea on how to resolve?

    Thx,
    Eldad

  16. How can I archive only single HTML file

    If I enter only html file name (like report.html) the plugin archives the whole workspace?! (my html file is in the root of the workspace)

    1. It will archive the directory containing the report as reports often contain images, CSS, and other goodies they link to.

      If you just have a single file, simply put it in a directory. For example, perhaps your last build step would be executing shell such as "mkdir -p reports && mv report.html reports", and then change your HTML Publisher report path to "reports/report.html". Ta-da!

  17. Hi - Slave jenkins which runs the tasks including post build actions (i.e running the html publish plugin) goes offline before the data is copied over to jenkins master and build fails saying the html output directory cannot be found.

    Have any of you encountered this issue?

    Thanks!

  18. Hi,

    I have a problem with my HTML Report because there are HTML report files to logs. The logs are not found and it shows an error HTTP 404.

    How can I solve this error?

    Thanks and regards.

  19. After a recent upgrade to Jenkins 1.610, I now see a build using the HTML publisher plug-in 1.3 fail with the following error.

    The upgrade to Jenkins server was the only significant change for this job. Is anyone else experiencing this issue in newer versions of Jenkins?

     [htmlpublisher] Archiving HTML reports...
    [htmlpublisher] Archiving at BUILD level /var/lib/jenkins-remote-root/workspace/dashboard-gerrit/platoReport to /var/lib/jenkins/jobs/dashboard-gerrit/builds/75/htmlreports/Code_Analysis_Report
    FATAL: HTML Publisher failure
    java.io.IOException: Failed to extract /var/lib/jenkins-remote-root/workspace/dashboard-gerrit/platoReport/**/*
        at hudson.FilePath.readFromTar(FilePath.java:2299)
        at hudson.FilePath.copyRecursiveTo(FilePath.java:2208)
        at hudson.FilePath.copyRecursiveTo(FilePath.java:2112)
        at hudson.FilePath.copyRecursiveTo(FilePath.java:2095)
        at htmlpublisher.HtmlPublisher.perform(HtmlPublisher.java:213)
        at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
        at hudson.model.Build$BuildExecution.post2(Build.java:183)
        at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
        at hudson.model.Run.execute(Run.java:1766)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:374)
    Caused by: java.io.IOException: Truncated TAR archive
        at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.read(TarArchiveInputStream.java:614)
        at java.io.InputStream.read(InputStream.java:101)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1792)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769)
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744)
        at hudson.util.IOUtils.copy(IOUtils.java:40)
        at hudson.FilePath.readFromTar(FilePath.java:2289)
        ... 13 more
    Build step 'Publish HTML reports' changed build result to FAILURE
    

    After some research and experimentation I was able to resolve this issue. It turned out that the HTML Publisher Plug-in was configured to archive a file that file did not exist. The HTML Publisher Plug-in did not complain, but something broke later on down the line.

    Since the upgrade to Jenkins 1.610, something may have changed in the way that archives are handled by Jenkins, so even though the HTML Publisher Plug-in did not throw an error, somewhere down the line Jenkins is trying to do something with a .tar file. If I remove the configuration that tells the HTML Publisher Plug-in to archive non-existent file platoReport/indexhtml, the build no longer fails. I don't know what's going on behind the scenes, but this was my experience. If you're having similar issues, I urge you to check the build output and ensure that the files expected by the HTML Publisher Plug-in exist. If they don't exist, try removing the configuration for those index pages.

  20. I get the following error while installing this plugin on Jenkins version 1.610java.io.IOException: Failed to dynamically deploy this plugin
    at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1322)
    at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1121)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(Unknown Source)
    at java.util.zip.ZipFile.<init>(Unknown Source)
    at java.util.jar.JarFile.<init>(Unknown Source)
    at java.util.jar.JarFile.<init>(Unknown Source)
    at hudson.ClassicPluginStrategy.getShortName(ClassicPluginStrategy.java:107)
    at hudson.PluginManager.dynamicLoad(PluginManager.java:438)
    at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1318)
    ... 6 more

  21. Probably a feature request:

    Could we change the report URL to something unique as:

    job/$job_name/htmlreports/$report_name

    This makes the url self-explanary, and also work better with inhertance plugin (which currently doesn't work well with htmlpublisher as the report URL is too general)

  22. The version history lists version 1.4 twice.

  23. failure information:

    htmlpublisher Archiving HTML reports...
    htmlpublisher Archiving at BUILD level D:\work\jenkins\jobs\maven\workspace\report\htmlReport to D:\work\jenkins\jobs\maven\builds\199\htmlreports\HTML_Report__
    ERROR: Directory 'D:\work\jenkins\jobs\maven\workspace\report\htmlReport' exists but failed copying to 'D:\work\jenkins\jobs\maven\builds\199\htmlreports\HTML_Report__'.
    ERROR: This is especially strange since your build otherwise succeeded.
    Build step 'Publish HTML reports' changed build result to FAILURE

    What was I supposed to do?

    Help me!

  24. Since Workflow support was added, I was trying it out. But when I added:

    step([$class: 'HtmlPublisher', directory: '**/target/serenity/site'])

    I got:

    java.lang.UnsupportedOperationException: no known implementation of interface jenkins.tasks.SimpleBuildStep is named HtmlPublisher

    The plugin is of course installed and a freestyle build collects the reports successfully.

    Any ideas anyone?

    ______________________________

    UPDATE: My config was wrong, partly due to my being a workflow newbie and partly due to not being able to find an example anywhere. The correct config is:

    publishHTML(target: [allowMissing: false, keepAll: true, reportDir: 'target/site/serenity', reportFiles: 'index.html', reportName: 'Serenity Report'])

    1. Hi Yannis! The wiki isn't the best place for bug reports, I'd recommend commenting in https://github.com/jenkinsci/htmlpublisher-plugin/pull/15 where this feature was added, and seeing if they can help you over there. I hope that helps, apologies that I am not familiar with the Workflow integration personally.

      1. Thanks Michael, I'll do that. In the first instance I assumed I might be doing something wrong, so I thought I'd ask for help rather than file a bug straight away/. :-) I'll do that now.

  25. We have Jenkins 1.644 installed and 1.11 version for this plugin. I know there has been a compatibility fix included for Content Security Policy. But when we try to open the HTML report it shows empty page like below. 

    Is there any other changes that i need  to do to make this work? Temporarily, I have Unset the header through script console, but i don't think that's what needs to be done. Any ideas?

    Thanks.

    1. The HTML Publisher plugin has its own section at https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy, please do give it a read, you will likely need to make changes!

  26. Hi

    add 'HTML Publisher plugin'  but html report display unreadable codes, can you help me?

    report should looks like following picture.

  27. BTW,

    use Latest Release 1.11

    1. Hi Bo! The HTML Publisher plugin has its own section at Configuring Content Security Policy, please do give it a read, you will likely need to make changes! And, based on your screenshot, you might need to specify a different encoding in your HTML document. If reading that doesn't address your issue, please file an issue in JIRA, no need to pollute comments here, thanks!

  28. Hi,

    I have a issue where in the reports is been displayed as below:
    In the tab after File tab, the bar is not displaying the percentage of the coverage and also when i click the any of the file the following error is been displayed:
    Please let me know if any solution is available for this..

    1. (deleted duplicate post)

  29. Hi 

    I am using this HTML plugin and very useful to us .. Thanks a lot .

    But i have an issue when i am have my master is UNIX box and slave is Windows box at that time .. it unable to publish HTML Report because it is trying copy the HTML folder from windows to unix box. But if both master and salve is windows then i don't have any issue.

    [htmlpublisher] Archiving at BUILD level \IP Address\oam\OAM_HTMLReport to /sw/pkg/jenkins2/home/jobs/OAM-DEV/builds/17/htmlreports/HTML_ReportFATAL: HTML Publisher failure
    Please let me know is their any way to resolve this issue 

    Regards,

    Venkat

  30. Hi,

    I have build that based on parameters will generate different reports. Sometimes we need to update just one of them, so not every build contains all reports. The problem is that after rebuilding and generating just one of reports, rest will disappear from main job page. Any configuration seems to work with this. Is it possible just to show most actual report on main page so when report is missing, just show older one?

    It seems to be a bug or missing functionality. There is no combination that allows missing report, keeping all reports and linking to last existing report. When report is missing, then it won't show link regardless of any settings. I think that "Keep past HTML reports" and "Allow missing report" should work that way depending on "Always link to last build" (eg. show link to last successful build with this report existing).

  31. Hi,
    I successfully installed and configured this awesome plugin, but sadly I run into a styling issue.
    My HTML report includes CSS and renders just fine, however the CSS does not seem to be loaded in the report when I navigate to it using the plugin (through the dashboard)
    Is there anything I might have missed in the config? or are there known styling issues?

    Kind regards,
    Cees Vogel

  32. Hi team,

     

    I am trying to use the plugin . but reports are not generating properly.When i saw the work space , the report is fine . but its not showing properly from Jenkins Build.

    PFA

    jenkins_error_1.PNGjenkins_error_2.PNG

    Real-Report.PNG

Write a comment…