3

I am using the HTML publisher plugin and I am generating html report and placing in a report folder report/profile.html. I have specified the path where my report is in HTML directory to archive. I gave the path as /apps/cmjenkins/workspace/service_testapps_copy/LISA Project/Mezzo_Automation/Reports. That gave directory does not exist error so gave the complete path as well: C:/Users/dtiker/Documents/Feb24/universe1_0_testapps/service_testapps/LISA Project/Mezzo_Automation/Reports

Below is the error i see in console output after i run my jenkins build

12:45:34 [htmlpublisher] Archiving HTML reports...
12:45:34 [htmlpublisher] Archiving at PROJECT level C:/Users/dtiker/Documents/Feb24/universe1_0_testapps/service_testapps/LISA Project/Mezzo_Automation/Reports to /var/lib/jenkins/jobs/API_PROFILE_HTML_Report_POC/htmlreports/HTML_Report
12:45:34 ERROR: Specified HTML directory 'C:/Users/dtiker/Documents/Feb24/universe1_0_testapps/service_testapps/LISA Project/Mezzo_Automation/Reports' does not exist.
12:45:34 Build step 'Publish HTML reports' changed build result to FAILURE
12:45:34 Finished: FAILURE

I verified that that directory does exist. Can someone let me know what i am doing wrong?

holms
  • 9,112
  • 14
  • 65
  • 95
user2864458
  • 41
  • 1
  • 1
  • 4

3 Answers3

1

Your job (each node{}) will use an own workspace, you should always reference files of the current build with a relative path!

publishHTML(reportDir: 'reports', reportFiles: 'profile.html'])
Christopher
  • 1,103
  • 1
  • 6
  • 18
  • 1
    I know this is a late comment, but I am stuck on this problem. Can you expand on this some? I am having the same issue. – Travis Tubbs Feb 21 '19 at 22:31
  • 1
    You need to make sure that you call the publish step in the same `node`/`agent`. – Christopher Feb 28 '19 at 15:33
  • Yeah I figured it out. My mocha reports were not being put in the same place that the HTML publisher was looking. Green horn mistake. – Travis Tubbs Feb 28 '19 at 16:34
  • I'm also stuck with this, I'm able to see even json files in that dir, and it's using workspace of that node (using docker-agents in here), but files are root:bin permission. Even tried to chown all files and folders and still got the error that folder is not found. Using relative paths in here. – holms Jun 28 '19 at 10:56
1

In my case misconfiguration of HTML publisher caused the problem

publishHTML([
  allowMissing: false,
  alwaysLinkToLastBuild: false,
  includes: '**/*.png',     <--------------------- this line
  keepAll: true,
  reportDir: 'reports/',
  reportFiles: 'friday_health_broker_portal_uat_index.html',
  reportName: 'HTML Report',
  reportTitles: 'FH BP'
 ])

Once I changed it includes to includes: '**/*' the problem was gone

Sergey Pleshakov
  • 7,964
  • 2
  • 17
  • 40
0

when I used file path in "filepath " instead of 'filepath ', then its working fine for me

stage ('publish results') {
      publishHTML([
          allowMissing: false, 
          alwaysLinkToLastBuild: true, 
          keepAll: false, 
          reportDir: "/var/lib/jenkins/workspace/project/target/site/serenity", 
          reportFiles: "index.html", 
          reportName: 'HTML Report', 
          reportTitles: ''
          ])
}
Maximilian Ast
  • 3,369
  • 12
  • 36
  • 47
akanshu
  • 41
  • 3