CSS formatting getting stripped out when viewing on jenkins

+1 vote
I’m facing a weird problem with my Jenkins HTML publisher plugin. I have a report where I’ve done all fancy css formatting and I’m unable to view it on Jenkins. If I download the report on my local and view it, its seen perfectly fine(with all formatting).

How am I supposed to solve it.
Aug 14, 2018 in DevOps & Agile by Hannah
• 18,520 points
4,703 views

1 answer to this question.

+1 vote

CSS is stripped out because of the Content Security Policy in Jenkins.

The default rule is set to:

sandbox; default-src 'none'; img-src 'self'; style-src 'self';

This rule set results in the following:

  • No JavaScript allowed at all
  • No plugins (object/embed) allowed
  • No inline CSS, or CSS from other sites allowed
  • No images from other sites allowed
  • No frames allowed
  • No web fonts allowed
  • No XHR/AJAX allowed, etc.

To relax this rule, go to Manage Jenkins->Script console and type in the following command:

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")

and Press Run. If you see the output as 'Result:' below "Result" header then the protection disabled. Re-Run your build and you can see that the new HTML files archived will have the CSS enabled.

answered Aug 14, 2018 by Kalgi
• 52,350 points

Related Questions In DevOps & Agile

0 votes
1 answer

What OS is Jenkins installed on Azure Virtual Machine?

Under Managed Jenkins there's a section called ...READ MORE

answered Apr 4, 2018 in DevOps & Agile by DareDev
• 6,890 points
856 views
0 votes
2 answers

Unable to use jenkins to run oracle script on remote DB

add ORACLE_HOME  in jenkins global variable. READ MORE

answered Mar 27, 2019 in DevOps & Agile by hal
6,034 views
0 votes
2 answers
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,715 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+6 votes
5 answers

can't remove SSIS variables using remove method on PowerShell

you're missing the additional $environment.Alter() after your ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by ajs3033
• 7,300 points
2,635 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP