简体   繁体   English

JETTY- HTML Publisher - Jenkins - Extent Reports - Images are broken 404 not found

[英]JETTY- HTML Publisher - Jenkins - Extent Reports - Images are broken 404 not found

The extent report that I generate running a Java Selenium project on a CentOS machine with jenkins it is showing partially correct.我在 CentOS 机器上运行 Java Selenium 项目生成的范围报告显示部分正确。 The issue comes when trying to view the screenshots that I have attached into the extent report on Jenkins on png format I am using HTML Publisher plugin on the latest version问题出现在尝试查看我在 Jenkins 上以 png 格式附加到范围报告中的屏幕截图时,我正在使用最新版本的 HTML Publisher 插件

I have already set this command on the jenkins command line System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")我已经在 jenkins 命令行上设置了这个命令 System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")

Extent Report on Jenkins Jenkins 的范围报告

The strange thing is when navigating directly on the CentOS file explorer and going to that path inside the jenkins workspace and opening the html report it is showing correctly as expected Extent Report opened inside CentOS explorer奇怪的是,当直接在 CentOS 文件资源管理器上导航并转到 jenkins 工作区内的该路径并打开 html 报告时,它按预期正确显示了Extent Report opened inside CentOS explorer

Has someone faced this issue before?有人以前遇到过这个问题吗?

Edit: This is the way I have the report inside a folder, including the jpg or png images at the same level of the html report files at same level of html report编辑:这是我将报告放在文件夹中的方式,包括与 html 报告文件相同级别的 jpg 或 png 图像,与 html 报告文件相同

EDIT: I have found a new important information for the issue.编辑:我发现了一个关于这个问题的新的重要信息。 I contacted a security teammate and he told me this was related to a configuration issue since port 8080 is listening correctly.我联系了一位安全队友,他告诉我这与配置问题有关,因为端口 8080 正在正确侦听。

Since Jenkins standalone is using a Jetty Http server it might be an issue with this.由于 Jenkins 独立使用 Jetty Http 服务器,因此这可能是一个问题。

Entering the jenkins logs I got this new information filtering the Jetty logs: JETTY LOGS Now I am working on troubleshooting this with the information with the logs输入 jenkins 日志我得到了过滤 Jetty 日志的新信息: JETTY LOGS现在我正在使用日志信息对此进行故障排除

When requesting image not found, the file not allowed请求图片时找不到,文件不允许

Update your Jenkins Content Security Policy.更新您的 Jenkins 内容安全政策。 With type into console the following commands:在控制台中输入以下命令:

System.clearProperty("hudson.model.DirectoryBrowserSupport.CSP");
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-scripts; default-src *; img-src * data: ;");

Go to Manage Jenkins -> Script Console on your jenkins Go Manage Jenkins -> Script Console

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM