我正在使用HTML Publisher插件,并且正在生成HTML报告并放入报告文件夹report/profile.html
。我已经指定了我在HTML目录中的报告到存档的路径。我把这条路作为/apps/cmjenkins/workspace/service_testapps_copy/LISA Project/Mezzo_Automation/Reports
。这给出了directory does not exist
错误,因此也给了完整的路径:C:/Users/dtiker/Documents/Feb24/universe1_0_testapps/service_testapps/LISA Project/Mezzo_Automation/Reports
下面是我运行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
我验证了该目录确实存在。有人可以让我知道我做错了什么吗?
您的工作(每个node{}
)将使用自己的工作区,您应始终使用相对路径引用当前构建的文件!
publishHTML(reportDir: 'reports', reportFiles: 'profile.html'])
在我的情况下,HTML发布者的配置错误引起了问题
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'
])
一旦我将includes
更改为includes: '**/*'
,问题就消失了
当我在" filepath"中使用文件路径而不是'filepath'时,它对我的工作正常
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: ''
])
}