Home > Article > Web Front-end > 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", "")
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!