HTML pages as archived artifacts

74 views
Skip to first unread message

Jochen Wiedmann

unread,
Jan 13, 2023, 8:37:42 AM1/13/23
to Jenkins Users

Hi,

one of my build jobs is creating a few reports (HTML pages), that are being archived as artifacts.

The created pages appear to be perfectly fine: If I download, and open them, then thy look exactly as expected.

Unfortunately, they don't look the same, if I view them within Jenkins by clicking on the respective artifact. I'm not enough of a web developer to tell, what's wrong, exactly, but the problem appears to be in the gray area of CSS / JavaScript.

Any ideas, what might be wrong, or suggestion, what I might do different?

Thanks,

Jochen 

christop...@googlemail.com

unread,
Jan 13, 2023, 9:51:12 AM1/13/23
to Jenkins Users
Hi Jochen,

one of my jobs generates a html-report as output from source code documentation (doxygen). Instead of archiving I hand the html over to publishHTML. Therefore displaying from the job works perfectly. I did not care for downloading the html though so you might need to do both.

BR,
Christoph

Xavier Raynaud

unread,
Jan 13, 2023, 10:23:05 AM1/13/23
to jenkinsci-users
Hi Jochen & Christoph

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

BR,
Xavier


From: "'christop...@googlemail.com' via Jenkins Users" <jenkins...@googlegroups.com>
To: "Jenkins Users" <jenkins...@googlegroups.com>
Sent: Friday, January 13, 2023 3:51:12 PM
Subject: Re: HTML pages as archived artifacts

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/644f1840-3307-4c18-98c6-e088d87b361fn%40googlegroups.com.

geoffroy...@gmail.com

unread,
Jan 16, 2023, 4:00:08 AM1/16/23
to Jenkins Users
Hello

I confirm that the publishHTML plugin will provide you with the needed feature. And also that you need to relax CSP rules for proper display, as mentioned by Xavier.

we use an init.groovy.d script to configure CSP (Content Security Policy) at Jenkins startup:

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-scripts allow-same-origin ; default-src 'self' ; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;")

Might be a bit permissive, but at least generated HTML docs using doxygen, mkdocs, ... with custom CSS are properly displaying from the publishHTML plugin.

Regards

Daniel Beck

unread,
Jan 16, 2023, 5:41:20 AM1/16/23
to jenkins...@googlegroups.com
On Mon, Jan 16, 2023 at 10:00 AM geoffroy...@gmail.com <geoffroy...@gmail.com> wrote:
you need to relax CSP rules for proper display, as mentioned by Xavier.

The recommended alternative for more than three years is to configure the resource root URL as explained on https://www.jenkins.io/doc/book/security/user-content/#resource-root-url
Reply all
Reply to author
Forward
0 new messages