Why does my CSS disappear in Jenkins HTML reports, but works locally?

Mary-Kate Olsen
Release: 2024-11-18 07:11:02
Original
124 people have browsed it

Why does my CSS disappear in Jenkins HTML reports, but works locally?

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:

  1. Navigate to "Manage Jenkins" > "Manage Nodes"
  2. Select the node and click "Settings"
  3. In the "Script console" section on the left, enter the command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
Copy after login
  1. Click "Run"

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!

source:php.cn
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