Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of several Solutions to the problem of html style in jenkins display

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Preface

Html report styles generated using the HTML Publisher plugin plug-in on jenkins are lost and need to be set up to display properly.

I. loss of style

1. The official document is explained as follows, refer to the address https://stackoverflow.com/questions/35783964/jenkins-html-publisher-plugin-no-css-is-displayed-when-report-is-viewed-in-j

For security reasons, loading of css and js is disabled, so it cannot be displayed.

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.

two。 The results of the presentation are as follows

II. Jenkins.msi solution

The installation of 1.jenkins is divided into jenkins.msi client installation and jenkins.war server installation. If it is jenkins.msi installation, find the jenkins.xml file.

two。 Open the jenkins.xml file with UE, find the arguments line in the following figure, change the red area to the following, change it, and save it:

It turned out to be-Xrs-Xmx256m-Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle-jar

Modified:-Xrs-Xmx256m-Dhudson.model.DirectoryBrowserSupport.CSP=-Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle-jar

III. Jenkins.war solution

Method 1:

1. If Jenkins is a war package, that is, deployed on tomcat, you can run the java command to solve the problem.

two。 Close jenkins first, open cmd and run Jenkins:java-Dhudson.model.DirectoryBrowserSupport.CSP=-jar with the following command

Java-Dhudson.model.DirectoryBrowserSupport.CSP=-jar D:\ Jenkins\ jenkins.war

Method 2:

1. You can directly change the catalina.bat file, find the catalina.bat file under tomcat/bin, open it with UE, and add a line of code.

Set JAVA_OPTS= "- Dhudson.model.DirectoryBrowserSupport.CSP=\" sandbox; default-src ""

(after the above methods are set, you need to restart jenkins)

4. Restart jenkins

1. Close jenkins first, add exit after the home page of the address bar jenkins, such as http://localhost:8080/exit, and then click Try POSTing to turn off jenkins.

two。 Restart jenkins. Add restart after the home page of the address bar jenkins, such as http://localhost:8080/restart, and click Yes to restart it.

3. After restarting, rebuild the job task that generated html before, and the html report can be displayed normally.

Original link: https://www.cnblogs.com/yoyoketang/p/7518351.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report