Jenkins - HTML Publisher Plugin - No CSS is displayed when report is viewed in Jenkins Server
I have a strange problem with the Jenkins HTML Publisher plugin, wherein all the fancy CSS I have added to the report is stripped out when viewed in Jenkins. If I download the report to local, I am able to see the CSS formatting. Is there a setting in Jenkins which allows CSS to be viewed?
My HTML Publisher Settings in Jenkins:
My Report Page when displayed in Jenkins :
My Report Page when displayed in Local :
html css jenkins jenkins-plugins
add a comment |
I have a strange problem with the Jenkins HTML Publisher plugin, wherein all the fancy CSS I have added to the report is stripped out when viewed in Jenkins. If I download the report to local, I am able to see the CSS formatting. Is there a setting in Jenkins which allows CSS to be viewed?
My HTML Publisher Settings in Jenkins:
My Report Page when displayed in Jenkins :
My Report Page when displayed in Local :
html css jenkins jenkins-plugins
Possible duplicate of Jenkins HTML Publisher Plugin: No external links with Jenkins 1.643
– Dave Bacher
Mar 4 '16 at 0:47
add a comment |
I have a strange problem with the Jenkins HTML Publisher plugin, wherein all the fancy CSS I have added to the report is stripped out when viewed in Jenkins. If I download the report to local, I am able to see the CSS formatting. Is there a setting in Jenkins which allows CSS to be viewed?
My HTML Publisher Settings in Jenkins:
My Report Page when displayed in Jenkins :
My Report Page when displayed in Local :
html css jenkins jenkins-plugins
I have a strange problem with the Jenkins HTML Publisher plugin, wherein all the fancy CSS I have added to the report is stripped out when viewed in Jenkins. If I download the report to local, I am able to see the CSS formatting. Is there a setting in Jenkins which allows CSS to be viewed?
My HTML Publisher Settings in Jenkins:
My Report Page when displayed in Jenkins :
My Report Page when displayed in Local :
html css jenkins jenkins-plugins
html css jenkins jenkins-plugins
edited Mar 4 '16 at 0:16
Andrew Myers
2,07651931
2,07651931
asked Mar 3 '16 at 22:03
VallVall
1,4522710
1,4522710
Possible duplicate of Jenkins HTML Publisher Plugin: No external links with Jenkins 1.643
– Dave Bacher
Mar 4 '16 at 0:47
add a comment |
Possible duplicate of Jenkins HTML Publisher Plugin: No external links with Jenkins 1.643
– Dave Bacher
Mar 4 '16 at 0:47
Possible duplicate of Jenkins HTML Publisher Plugin: No external links with Jenkins 1.643
– Dave Bacher
Mar 4 '16 at 0:47
Possible duplicate of Jenkins HTML Publisher Plugin: No external links with Jenkins 1.643
– Dave Bacher
Mar 4 '16 at 0:47
add a comment |
10 Answers
10
active
oldest
votes
Figured out the issue. Sharing it here for other users.
CSS is stripped out because of the Content Security Policy in Jenkins. (https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy)
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->
- Manage Nodes->
- Click settings(gear icon)->
click Script console on left 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.
Thank you!!! It really helped me solve this css issue I had with jenkins.
– Eyal Sooliman
Jul 3 '16 at 14:05
11
Is there a way of setting this permanently?
– Steerpike
Nov 4 '16 at 15:56
1
@Steerpike I wondered what you meant and then found out that the css was blocked upon restarting Jenkins. So I created a Jenkins job that runs the command every 12 hours. Seems to do the trick.
– Aeropher
Nov 25 '16 at 17:23
@Aeropher thank you - I am a Jenkins novice - how do I setup that job? Setup a general job with a Build Step of Execute Windows Batch Command?
– Steerpike
Feb 3 '17 at 11:11
2
@Steerpike That's right except it is a groovy command, so you need to execute it in an "Execute system Groovy Script" build step. And then under the "Build Triggers" section I selected "Build Periodically" with this value: H 12 * * *
– Aeropher
Feb 6 '17 at 9:38
|
show 4 more comments
(The following solution is for Windows.)
A permanent fix is to change a line in [Jenkins directory]jenkins.xml
(for me it's at C:Jenkinsjenkins.xml
)
<executable>java.exe</executable>
<arguments>[arguments are here]</arguments>
Add the following argument to the whitespace-separated list of arguments:
-Dhudson.model.DirectoryBrowserSupport.CSP=
Then restart the Jenkins service to pick up the change.
add a comment |
You can fix this by using the groovy command as specified in Vall's answer.
The effect is in place until Jenkins restarts and afterwards you have to do it again.
A solution to solve this problem is to configure a job that will do this for you whenever jenkins starts up.
You can do this by using the Startup Trigger plugin.
After you install it create a new job and you will have a new checkbox under the Build Triggers section that you will have to check.
Then add an Execute system Groovy script build step with the command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","")
Save and everything should work.
add a comment |
Go to “Manage Jenkins” -> “Script console”
and run below command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
add a comment |
In CentOs, to enable images in html report
sudo vi /etc/sysconfig/jenkins
- set following in
JENKINS_JAVA_OPTION
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' data:;""
This will work even after restarting jenkins' server.
Directive
default-src: The default-src is the default policy for loading content such as JavaScript, Images, CSS, Fonts, AJAX requests, Frames, HTML5 Media
img-src: Defines valid sources of images.
Source Value
' self ' - Allows loading resources from the same origin (same scheme, host and port).
Usage :
default-src 'self'
' unsafe-inline ' - Allows use of inline source elements such as style attribute, onclick, or script tag bodies (depends on the context of the source it is applied to) and javascript: URIs.
Usage :
default-src 'unsafe-inline'
' unsafe-eval ' - Allows unsafe dynamic code evaluation such as JavaScript eval()
Usage :
default-src 'unsafe-eval'
data: - Allows loading resources via the data scheme (eg Base64 encoded images).
Usage :
img-src 'self' data:
Please refer more about content security policy here
the only one which work for me
– Adiii
Feb 26 '18 at 11:13
add a comment |
For Ubuntu 14 version helpful was special plugins:
https://wiki.jenkins-ci.org/display/JENKINS/Startup+Trigger - To start job on jenkins startup
https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin - To run System Groovy script
And I made a job, that starts on Jenkins restart and sets parametr.
And added system Groovy script to set parametr.
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; img-src 'self';")
Although running the job completes successfully, it does not enable the CSS display for my reports. I ran the exact same groovy script in the "Script Console" and that worked fine. What else can I do? This job's groovy script is not changing the actual parent Jenkin's property.
– frakman1
Oct 19 '17 at 19:02
@frakman1 at this moment my Groovy script looks like this - System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") But that's all and everything works. Maybe you don't have admin user?
– abiab
Nov 7 '17 at 9:25
Thank you for the response. I eventually got it to work. I had to use this script instead:System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-same-origin allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *")
– frakman1
Nov 8 '17 at 16:04
add a comment |
It's too late to respond but thought to share.
I was struggling with Jenkins deployed on Tomcat, tried execution of script, it helps but goes away if tomcat is rebooted.
Made the permanent fix by setting the property in catalina.properties in tomcat.
Properties file: tomcat_installation_dir/conf/catalina.properties
Just copy paste the below line in catalina.properties at the last (you can set it anywhere just to not mess with existing properties)
-Dhudson.model.DirectoryBrowserSupport.CSP=""
add a comment |
I had the same issues after adding HTTPS to my jenkins. In case you are having the same issue, the solution is easy - set your Jenkins url to use HTTPS protocol instead of HTTP. It can be configured via jenkins configuration -> jenkins url
add a comment |
Go To
Manage Jenkins --> Script console
and type in the following command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
then Press Run. if you get the output as 'Result', then rerun the build check the HTML report format
add a comment |
On Debian/Ubuntu, in aptitude installations:
sudo vi /etc/default/jenkins
- Add
-Dhudson.model.DirectoryBrowserSupport.CSP=
to theJAVA_ARGS
(e.g.JAVA_ARGS="-Dhudson.model.DirectoryBrowserSupport.CSP="
) - Restart jenkins -
service jenkins restart
This is was enough for me, but for the full list of parameters see this answer.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35783964%2fjenkins-html-publisher-plugin-no-css-is-displayed-when-report-is-viewed-in-j%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
10 Answers
10
active
oldest
votes
10 Answers
10
active
oldest
votes
active
oldest
votes
active
oldest
votes
Figured out the issue. Sharing it here for other users.
CSS is stripped out because of the Content Security Policy in Jenkins. (https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy)
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->
- Manage Nodes->
- Click settings(gear icon)->
click Script console on left 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.
Thank you!!! It really helped me solve this css issue I had with jenkins.
– Eyal Sooliman
Jul 3 '16 at 14:05
11
Is there a way of setting this permanently?
– Steerpike
Nov 4 '16 at 15:56
1
@Steerpike I wondered what you meant and then found out that the css was blocked upon restarting Jenkins. So I created a Jenkins job that runs the command every 12 hours. Seems to do the trick.
– Aeropher
Nov 25 '16 at 17:23
@Aeropher thank you - I am a Jenkins novice - how do I setup that job? Setup a general job with a Build Step of Execute Windows Batch Command?
– Steerpike
Feb 3 '17 at 11:11
2
@Steerpike That's right except it is a groovy command, so you need to execute it in an "Execute system Groovy Script" build step. And then under the "Build Triggers" section I selected "Build Periodically" with this value: H 12 * * *
– Aeropher
Feb 6 '17 at 9:38
|
show 4 more comments
Figured out the issue. Sharing it here for other users.
CSS is stripped out because of the Content Security Policy in Jenkins. (https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy)
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->
- Manage Nodes->
- Click settings(gear icon)->
click Script console on left 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.
Thank you!!! It really helped me solve this css issue I had with jenkins.
– Eyal Sooliman
Jul 3 '16 at 14:05
11
Is there a way of setting this permanently?
– Steerpike
Nov 4 '16 at 15:56
1
@Steerpike I wondered what you meant and then found out that the css was blocked upon restarting Jenkins. So I created a Jenkins job that runs the command every 12 hours. Seems to do the trick.
– Aeropher
Nov 25 '16 at 17:23
@Aeropher thank you - I am a Jenkins novice - how do I setup that job? Setup a general job with a Build Step of Execute Windows Batch Command?
– Steerpike
Feb 3 '17 at 11:11
2
@Steerpike That's right except it is a groovy command, so you need to execute it in an "Execute system Groovy Script" build step. And then under the "Build Triggers" section I selected "Build Periodically" with this value: H 12 * * *
– Aeropher
Feb 6 '17 at 9:38
|
show 4 more comments
Figured out the issue. Sharing it here for other users.
CSS is stripped out because of the Content Security Policy in Jenkins. (https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy)
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->
- Manage Nodes->
- Click settings(gear icon)->
click Script console on left 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.
Figured out the issue. Sharing it here for other users.
CSS is stripped out because of the Content Security Policy in Jenkins. (https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy)
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->
- Manage Nodes->
- Click settings(gear icon)->
click Script console on left 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.
edited Jan 17 at 11:39
paul
1,621103874
1,621103874
answered Mar 4 '16 at 0:25
VallVall
1,4522710
1,4522710
Thank you!!! It really helped me solve this css issue I had with jenkins.
– Eyal Sooliman
Jul 3 '16 at 14:05
11
Is there a way of setting this permanently?
– Steerpike
Nov 4 '16 at 15:56
1
@Steerpike I wondered what you meant and then found out that the css was blocked upon restarting Jenkins. So I created a Jenkins job that runs the command every 12 hours. Seems to do the trick.
– Aeropher
Nov 25 '16 at 17:23
@Aeropher thank you - I am a Jenkins novice - how do I setup that job? Setup a general job with a Build Step of Execute Windows Batch Command?
– Steerpike
Feb 3 '17 at 11:11
2
@Steerpike That's right except it is a groovy command, so you need to execute it in an "Execute system Groovy Script" build step. And then under the "Build Triggers" section I selected "Build Periodically" with this value: H 12 * * *
– Aeropher
Feb 6 '17 at 9:38
|
show 4 more comments
Thank you!!! It really helped me solve this css issue I had with jenkins.
– Eyal Sooliman
Jul 3 '16 at 14:05
11
Is there a way of setting this permanently?
– Steerpike
Nov 4 '16 at 15:56
1
@Steerpike I wondered what you meant and then found out that the css was blocked upon restarting Jenkins. So I created a Jenkins job that runs the command every 12 hours. Seems to do the trick.
– Aeropher
Nov 25 '16 at 17:23
@Aeropher thank you - I am a Jenkins novice - how do I setup that job? Setup a general job with a Build Step of Execute Windows Batch Command?
– Steerpike
Feb 3 '17 at 11:11
2
@Steerpike That's right except it is a groovy command, so you need to execute it in an "Execute system Groovy Script" build step. And then under the "Build Triggers" section I selected "Build Periodically" with this value: H 12 * * *
– Aeropher
Feb 6 '17 at 9:38
Thank you!!! It really helped me solve this css issue I had with jenkins.
– Eyal Sooliman
Jul 3 '16 at 14:05
Thank you!!! It really helped me solve this css issue I had with jenkins.
– Eyal Sooliman
Jul 3 '16 at 14:05
11
11
Is there a way of setting this permanently?
– Steerpike
Nov 4 '16 at 15:56
Is there a way of setting this permanently?
– Steerpike
Nov 4 '16 at 15:56
1
1
@Steerpike I wondered what you meant and then found out that the css was blocked upon restarting Jenkins. So I created a Jenkins job that runs the command every 12 hours. Seems to do the trick.
– Aeropher
Nov 25 '16 at 17:23
@Steerpike I wondered what you meant and then found out that the css was blocked upon restarting Jenkins. So I created a Jenkins job that runs the command every 12 hours. Seems to do the trick.
– Aeropher
Nov 25 '16 at 17:23
@Aeropher thank you - I am a Jenkins novice - how do I setup that job? Setup a general job with a Build Step of Execute Windows Batch Command?
– Steerpike
Feb 3 '17 at 11:11
@Aeropher thank you - I am a Jenkins novice - how do I setup that job? Setup a general job with a Build Step of Execute Windows Batch Command?
– Steerpike
Feb 3 '17 at 11:11
2
2
@Steerpike That's right except it is a groovy command, so you need to execute it in an "Execute system Groovy Script" build step. And then under the "Build Triggers" section I selected "Build Periodically" with this value: H 12 * * *
– Aeropher
Feb 6 '17 at 9:38
@Steerpike That's right except it is a groovy command, so you need to execute it in an "Execute system Groovy Script" build step. And then under the "Build Triggers" section I selected "Build Periodically" with this value: H 12 * * *
– Aeropher
Feb 6 '17 at 9:38
|
show 4 more comments
(The following solution is for Windows.)
A permanent fix is to change a line in [Jenkins directory]jenkins.xml
(for me it's at C:Jenkinsjenkins.xml
)
<executable>java.exe</executable>
<arguments>[arguments are here]</arguments>
Add the following argument to the whitespace-separated list of arguments:
-Dhudson.model.DirectoryBrowserSupport.CSP=
Then restart the Jenkins service to pick up the change.
add a comment |
(The following solution is for Windows.)
A permanent fix is to change a line in [Jenkins directory]jenkins.xml
(for me it's at C:Jenkinsjenkins.xml
)
<executable>java.exe</executable>
<arguments>[arguments are here]</arguments>
Add the following argument to the whitespace-separated list of arguments:
-Dhudson.model.DirectoryBrowserSupport.CSP=
Then restart the Jenkins service to pick up the change.
add a comment |
(The following solution is for Windows.)
A permanent fix is to change a line in [Jenkins directory]jenkins.xml
(for me it's at C:Jenkinsjenkins.xml
)
<executable>java.exe</executable>
<arguments>[arguments are here]</arguments>
Add the following argument to the whitespace-separated list of arguments:
-Dhudson.model.DirectoryBrowserSupport.CSP=
Then restart the Jenkins service to pick up the change.
(The following solution is for Windows.)
A permanent fix is to change a line in [Jenkins directory]jenkins.xml
(for me it's at C:Jenkinsjenkins.xml
)
<executable>java.exe</executable>
<arguments>[arguments are here]</arguments>
Add the following argument to the whitespace-separated list of arguments:
-Dhudson.model.DirectoryBrowserSupport.CSP=
Then restart the Jenkins service to pick up the change.
answered Feb 22 '17 at 3:42
twasbrilligtwasbrillig
6,39242452
6,39242452
add a comment |
add a comment |
You can fix this by using the groovy command as specified in Vall's answer.
The effect is in place until Jenkins restarts and afterwards you have to do it again.
A solution to solve this problem is to configure a job that will do this for you whenever jenkins starts up.
You can do this by using the Startup Trigger plugin.
After you install it create a new job and you will have a new checkbox under the Build Triggers section that you will have to check.
Then add an Execute system Groovy script build step with the command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","")
Save and everything should work.
add a comment |
You can fix this by using the groovy command as specified in Vall's answer.
The effect is in place until Jenkins restarts and afterwards you have to do it again.
A solution to solve this problem is to configure a job that will do this for you whenever jenkins starts up.
You can do this by using the Startup Trigger plugin.
After you install it create a new job and you will have a new checkbox under the Build Triggers section that you will have to check.
Then add an Execute system Groovy script build step with the command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","")
Save and everything should work.
add a comment |
You can fix this by using the groovy command as specified in Vall's answer.
The effect is in place until Jenkins restarts and afterwards you have to do it again.
A solution to solve this problem is to configure a job that will do this for you whenever jenkins starts up.
You can do this by using the Startup Trigger plugin.
After you install it create a new job and you will have a new checkbox under the Build Triggers section that you will have to check.
Then add an Execute system Groovy script build step with the command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","")
Save and everything should work.
You can fix this by using the groovy command as specified in Vall's answer.
The effect is in place until Jenkins restarts and afterwards you have to do it again.
A solution to solve this problem is to configure a job that will do this for you whenever jenkins starts up.
You can do this by using the Startup Trigger plugin.
After you install it create a new job and you will have a new checkbox under the Build Triggers section that you will have to check.
Then add an Execute system Groovy script build step with the command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","")
Save and everything should work.
edited May 23 '17 at 12:02
Community♦
11
11
answered Mar 9 '17 at 11:57
dragosbdragosb
285316
285316
add a comment |
add a comment |
Go to “Manage Jenkins” -> “Script console”
and run below command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
add a comment |
Go to “Manage Jenkins” -> “Script console”
and run below command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
add a comment |
Go to “Manage Jenkins” -> “Script console”
and run below command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
Go to “Manage Jenkins” -> “Script console”
and run below command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
edited Nov 14 '18 at 7:14
answered May 16 '18 at 20:14
SomSom
3,38031729
3,38031729
add a comment |
add a comment |
In CentOs, to enable images in html report
sudo vi /etc/sysconfig/jenkins
- set following in
JENKINS_JAVA_OPTION
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' data:;""
This will work even after restarting jenkins' server.
Directive
default-src: The default-src is the default policy for loading content such as JavaScript, Images, CSS, Fonts, AJAX requests, Frames, HTML5 Media
img-src: Defines valid sources of images.
Source Value
' self ' - Allows loading resources from the same origin (same scheme, host and port).
Usage :
default-src 'self'
' unsafe-inline ' - Allows use of inline source elements such as style attribute, onclick, or script tag bodies (depends on the context of the source it is applied to) and javascript: URIs.
Usage :
default-src 'unsafe-inline'
' unsafe-eval ' - Allows unsafe dynamic code evaluation such as JavaScript eval()
Usage :
default-src 'unsafe-eval'
data: - Allows loading resources via the data scheme (eg Base64 encoded images).
Usage :
img-src 'self' data:
Please refer more about content security policy here
the only one which work for me
– Adiii
Feb 26 '18 at 11:13
add a comment |
In CentOs, to enable images in html report
sudo vi /etc/sysconfig/jenkins
- set following in
JENKINS_JAVA_OPTION
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' data:;""
This will work even after restarting jenkins' server.
Directive
default-src: The default-src is the default policy for loading content such as JavaScript, Images, CSS, Fonts, AJAX requests, Frames, HTML5 Media
img-src: Defines valid sources of images.
Source Value
' self ' - Allows loading resources from the same origin (same scheme, host and port).
Usage :
default-src 'self'
' unsafe-inline ' - Allows use of inline source elements such as style attribute, onclick, or script tag bodies (depends on the context of the source it is applied to) and javascript: URIs.
Usage :
default-src 'unsafe-inline'
' unsafe-eval ' - Allows unsafe dynamic code evaluation such as JavaScript eval()
Usage :
default-src 'unsafe-eval'
data: - Allows loading resources via the data scheme (eg Base64 encoded images).
Usage :
img-src 'self' data:
Please refer more about content security policy here
the only one which work for me
– Adiii
Feb 26 '18 at 11:13
add a comment |
In CentOs, to enable images in html report
sudo vi /etc/sysconfig/jenkins
- set following in
JENKINS_JAVA_OPTION
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' data:;""
This will work even after restarting jenkins' server.
Directive
default-src: The default-src is the default policy for loading content such as JavaScript, Images, CSS, Fonts, AJAX requests, Frames, HTML5 Media
img-src: Defines valid sources of images.
Source Value
' self ' - Allows loading resources from the same origin (same scheme, host and port).
Usage :
default-src 'self'
' unsafe-inline ' - Allows use of inline source elements such as style attribute, onclick, or script tag bodies (depends on the context of the source it is applied to) and javascript: URIs.
Usage :
default-src 'unsafe-inline'
' unsafe-eval ' - Allows unsafe dynamic code evaluation such as JavaScript eval()
Usage :
default-src 'unsafe-eval'
data: - Allows loading resources via the data scheme (eg Base64 encoded images).
Usage :
img-src 'self' data:
Please refer more about content security policy here
In CentOs, to enable images in html report
sudo vi /etc/sysconfig/jenkins
- set following in
JENKINS_JAVA_OPTION
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' data:;""
This will work even after restarting jenkins' server.
Directive
default-src: The default-src is the default policy for loading content such as JavaScript, Images, CSS, Fonts, AJAX requests, Frames, HTML5 Media
img-src: Defines valid sources of images.
Source Value
' self ' - Allows loading resources from the same origin (same scheme, host and port).
Usage :
default-src 'self'
' unsafe-inline ' - Allows use of inline source elements such as style attribute, onclick, or script tag bodies (depends on the context of the source it is applied to) and javascript: URIs.
Usage :
default-src 'unsafe-inline'
' unsafe-eval ' - Allows unsafe dynamic code evaluation such as JavaScript eval()
Usage :
default-src 'unsafe-eval'
data: - Allows loading resources via the data scheme (eg Base64 encoded images).
Usage :
img-src 'self' data:
Please refer more about content security policy here
edited Jan 17 at 11:49
Quasimodo's clone
3,71111028
3,71111028
answered Sep 28 '17 at 7:27
jithinkmatthewjithinkmatthew
181110
181110
the only one which work for me
– Adiii
Feb 26 '18 at 11:13
add a comment |
the only one which work for me
– Adiii
Feb 26 '18 at 11:13
the only one which work for me
– Adiii
Feb 26 '18 at 11:13
the only one which work for me
– Adiii
Feb 26 '18 at 11:13
add a comment |
For Ubuntu 14 version helpful was special plugins:
https://wiki.jenkins-ci.org/display/JENKINS/Startup+Trigger - To start job on jenkins startup
https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin - To run System Groovy script
And I made a job, that starts on Jenkins restart and sets parametr.
And added system Groovy script to set parametr.
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; img-src 'self';")
Although running the job completes successfully, it does not enable the CSS display for my reports. I ran the exact same groovy script in the "Script Console" and that worked fine. What else can I do? This job's groovy script is not changing the actual parent Jenkin's property.
– frakman1
Oct 19 '17 at 19:02
@frakman1 at this moment my Groovy script looks like this - System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") But that's all and everything works. Maybe you don't have admin user?
– abiab
Nov 7 '17 at 9:25
Thank you for the response. I eventually got it to work. I had to use this script instead:System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-same-origin allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *")
– frakman1
Nov 8 '17 at 16:04
add a comment |
For Ubuntu 14 version helpful was special plugins:
https://wiki.jenkins-ci.org/display/JENKINS/Startup+Trigger - To start job on jenkins startup
https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin - To run System Groovy script
And I made a job, that starts on Jenkins restart and sets parametr.
And added system Groovy script to set parametr.
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; img-src 'self';")
Although running the job completes successfully, it does not enable the CSS display for my reports. I ran the exact same groovy script in the "Script Console" and that worked fine. What else can I do? This job's groovy script is not changing the actual parent Jenkin's property.
– frakman1
Oct 19 '17 at 19:02
@frakman1 at this moment my Groovy script looks like this - System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") But that's all and everything works. Maybe you don't have admin user?
– abiab
Nov 7 '17 at 9:25
Thank you for the response. I eventually got it to work. I had to use this script instead:System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-same-origin allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *")
– frakman1
Nov 8 '17 at 16:04
add a comment |
For Ubuntu 14 version helpful was special plugins:
https://wiki.jenkins-ci.org/display/JENKINS/Startup+Trigger - To start job on jenkins startup
https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin - To run System Groovy script
And I made a job, that starts on Jenkins restart and sets parametr.
And added system Groovy script to set parametr.
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; img-src 'self';")
For Ubuntu 14 version helpful was special plugins:
https://wiki.jenkins-ci.org/display/JENKINS/Startup+Trigger - To start job on jenkins startup
https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin - To run System Groovy script
And I made a job, that starts on Jenkins restart and sets parametr.
And added system Groovy script to set parametr.
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; img-src 'self';")
edited May 17 '17 at 8:30
answered May 16 '17 at 6:35
abiababiab
387
387
Although running the job completes successfully, it does not enable the CSS display for my reports. I ran the exact same groovy script in the "Script Console" and that worked fine. What else can I do? This job's groovy script is not changing the actual parent Jenkin's property.
– frakman1
Oct 19 '17 at 19:02
@frakman1 at this moment my Groovy script looks like this - System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") But that's all and everything works. Maybe you don't have admin user?
– abiab
Nov 7 '17 at 9:25
Thank you for the response. I eventually got it to work. I had to use this script instead:System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-same-origin allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *")
– frakman1
Nov 8 '17 at 16:04
add a comment |
Although running the job completes successfully, it does not enable the CSS display for my reports. I ran the exact same groovy script in the "Script Console" and that worked fine. What else can I do? This job's groovy script is not changing the actual parent Jenkin's property.
– frakman1
Oct 19 '17 at 19:02
@frakman1 at this moment my Groovy script looks like this - System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") But that's all and everything works. Maybe you don't have admin user?
– abiab
Nov 7 '17 at 9:25
Thank you for the response. I eventually got it to work. I had to use this script instead:System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-same-origin allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *")
– frakman1
Nov 8 '17 at 16:04
Although running the job completes successfully, it does not enable the CSS display for my reports. I ran the exact same groovy script in the "Script Console" and that worked fine. What else can I do? This job's groovy script is not changing the actual parent Jenkin's property.
– frakman1
Oct 19 '17 at 19:02
Although running the job completes successfully, it does not enable the CSS display for my reports. I ran the exact same groovy script in the "Script Console" and that worked fine. What else can I do? This job's groovy script is not changing the actual parent Jenkin's property.
– frakman1
Oct 19 '17 at 19:02
@frakman1 at this moment my Groovy script looks like this - System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") But that's all and everything works. Maybe you don't have admin user?
– abiab
Nov 7 '17 at 9:25
@frakman1 at this moment my Groovy script looks like this - System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") But that's all and everything works. Maybe you don't have admin user?
– abiab
Nov 7 '17 at 9:25
Thank you for the response. I eventually got it to work. I had to use this script instead:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-same-origin allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *")
– frakman1
Nov 8 '17 at 16:04
Thank you for the response. I eventually got it to work. I had to use this script instead:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-same-origin allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *")
– frakman1
Nov 8 '17 at 16:04
add a comment |
It's too late to respond but thought to share.
I was struggling with Jenkins deployed on Tomcat, tried execution of script, it helps but goes away if tomcat is rebooted.
Made the permanent fix by setting the property in catalina.properties in tomcat.
Properties file: tomcat_installation_dir/conf/catalina.properties
Just copy paste the below line in catalina.properties at the last (you can set it anywhere just to not mess with existing properties)
-Dhudson.model.DirectoryBrowserSupport.CSP=""
add a comment |
It's too late to respond but thought to share.
I was struggling with Jenkins deployed on Tomcat, tried execution of script, it helps but goes away if tomcat is rebooted.
Made the permanent fix by setting the property in catalina.properties in tomcat.
Properties file: tomcat_installation_dir/conf/catalina.properties
Just copy paste the below line in catalina.properties at the last (you can set it anywhere just to not mess with existing properties)
-Dhudson.model.DirectoryBrowserSupport.CSP=""
add a comment |
It's too late to respond but thought to share.
I was struggling with Jenkins deployed on Tomcat, tried execution of script, it helps but goes away if tomcat is rebooted.
Made the permanent fix by setting the property in catalina.properties in tomcat.
Properties file: tomcat_installation_dir/conf/catalina.properties
Just copy paste the below line in catalina.properties at the last (you can set it anywhere just to not mess with existing properties)
-Dhudson.model.DirectoryBrowserSupport.CSP=""
It's too late to respond but thought to share.
I was struggling with Jenkins deployed on Tomcat, tried execution of script, it helps but goes away if tomcat is rebooted.
Made the permanent fix by setting the property in catalina.properties in tomcat.
Properties file: tomcat_installation_dir/conf/catalina.properties
Just copy paste the below line in catalina.properties at the last (you can set it anywhere just to not mess with existing properties)
-Dhudson.model.DirectoryBrowserSupport.CSP=""
answered Feb 19 '18 at 13:38
Java DeveloperJava Developer
12
12
add a comment |
add a comment |
I had the same issues after adding HTTPS to my jenkins. In case you are having the same issue, the solution is easy - set your Jenkins url to use HTTPS protocol instead of HTTP. It can be configured via jenkins configuration -> jenkins url
add a comment |
I had the same issues after adding HTTPS to my jenkins. In case you are having the same issue, the solution is easy - set your Jenkins url to use HTTPS protocol instead of HTTP. It can be configured via jenkins configuration -> jenkins url
add a comment |
I had the same issues after adding HTTPS to my jenkins. In case you are having the same issue, the solution is easy - set your Jenkins url to use HTTPS protocol instead of HTTP. It can be configured via jenkins configuration -> jenkins url
I had the same issues after adding HTTPS to my jenkins. In case you are having the same issue, the solution is easy - set your Jenkins url to use HTTPS protocol instead of HTTP. It can be configured via jenkins configuration -> jenkins url
answered Mar 5 '18 at 8:20
Ben YitzhakiBen Yitzhaki
731819
731819
add a comment |
add a comment |
Go To
Manage Jenkins --> Script console
and type in the following command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
then Press Run. if you get the output as 'Result', then rerun the build check the HTML report format
add a comment |
Go To
Manage Jenkins --> Script console
and type in the following command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
then Press Run. if you get the output as 'Result', then rerun the build check the HTML report format
add a comment |
Go To
Manage Jenkins --> Script console
and type in the following command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
then Press Run. if you get the output as 'Result', then rerun the build check the HTML report format
Go To
Manage Jenkins --> Script console
and type in the following command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
then Press Run. if you get the output as 'Result', then rerun the build check the HTML report format
edited Aug 13 '18 at 9:24
bajran
262311
262311
answered Aug 13 '18 at 9:20
ShailendraShailendra
94
94
add a comment |
add a comment |
On Debian/Ubuntu, in aptitude installations:
sudo vi /etc/default/jenkins
- Add
-Dhudson.model.DirectoryBrowserSupport.CSP=
to theJAVA_ARGS
(e.g.JAVA_ARGS="-Dhudson.model.DirectoryBrowserSupport.CSP="
) - Restart jenkins -
service jenkins restart
This is was enough for me, but for the full list of parameters see this answer.
add a comment |
On Debian/Ubuntu, in aptitude installations:
sudo vi /etc/default/jenkins
- Add
-Dhudson.model.DirectoryBrowserSupport.CSP=
to theJAVA_ARGS
(e.g.JAVA_ARGS="-Dhudson.model.DirectoryBrowserSupport.CSP="
) - Restart jenkins -
service jenkins restart
This is was enough for me, but for the full list of parameters see this answer.
add a comment |
On Debian/Ubuntu, in aptitude installations:
sudo vi /etc/default/jenkins
- Add
-Dhudson.model.DirectoryBrowserSupport.CSP=
to theJAVA_ARGS
(e.g.JAVA_ARGS="-Dhudson.model.DirectoryBrowserSupport.CSP="
) - Restart jenkins -
service jenkins restart
This is was enough for me, but for the full list of parameters see this answer.
On Debian/Ubuntu, in aptitude installations:
sudo vi /etc/default/jenkins
- Add
-Dhudson.model.DirectoryBrowserSupport.CSP=
to theJAVA_ARGS
(e.g.JAVA_ARGS="-Dhudson.model.DirectoryBrowserSupport.CSP="
) - Restart jenkins -
service jenkins restart
This is was enough for me, but for the full list of parameters see this answer.
answered Nov 16 '17 at 10:37
bushibushi
194
194
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35783964%2fjenkins-html-publisher-plugin-no-css-is-displayed-when-report-is-viewed-in-j%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of Jenkins HTML Publisher Plugin: No external links with Jenkins 1.643
– Dave Bacher
Mar 4 '16 at 0:47