Jenkins HTML Publisher Plugin: CSS Issue in Jenkins Server
Jenkins users encounter a peculiar problem when using the HTML Publisher plugin. CSS styling applied to HTML reports disappears when viewed in Jenkins. However, the CSS is intact when downloaded locally.
To resolve this issue, it's essential to understand Content Security Policy (CSP) in Jenkins. By default, CSP is set to prevent inline CSS and CSS from other sites.
Solution:
To disable this protection:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
If "Result:" appears below the "Result" header, protection has been disabled. Rerunning the build will display the CSS in the archived HTML reports.
The above is the detailed content of Why does my CSS disappear in Jenkins HTML reports, but works locally?. For more information, please follow other related articles on the PHP Chinese website!