Home > Web Front-end > CSS Tutorial > Why Is My HTML Report Not Displaying CSS Styles in Jenkins?

Why Is My HTML Report Not Displaying CSS Styles in Jenkins?

Mary-Kate Olsen
Release: 2024-11-12 22:05:02
Original
734 people have browsed it

Why Is My HTML Report Not Displaying CSS Styles in Jenkins?

Jenkins - HTML Publisher Plugin

When using the Jenkins HTML Publisher plugin, users may encounter an issue where the CSS styles applied to the report are not displayed when viewed in Jenkins. However, the formatting is visible when the report is downloaded locally. This is caused by the Content Security Policy (CSP) in Jenkins.

The default CSP rules set by Jenkins are strict and prevent inline CSS, external CSS, and other resources from being loaded. To resolve this issue, you need to relax the CSP rules.

Navigate to Manage Jenkins > Manage Nodes and click the settings icon. On the left navigation panel, click Script console. Type the following command:

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
Copy after login

Press Run. If the output displays 'Result:' below the "Result" header, the CSP protection is disabled.

Re-run your build, and you should now see the CSS styles applied to the HTML report when viewed in Jenkins.

The above is the detailed content of Why Is My HTML Report Not Displaying CSS Styles in Jenkins?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template