解決在jenkins中沒法打開robot framework report.html log.html的問題

問題描述: javascript

Opening Robot Framework report failed css

  • Verify that you have JavaScript enabled in your browser.
  • Make sure you are using a modern enough browser. Firefox 3.5, IE 8, or equivalent is required, newer browsers are recommended.
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.

   

來自 <http://localhost:8080/job/robot%E6%B5%8B%E8%AF%95/8/robot/report/report.html> html

   

   

以前,用的還好好的,爲何如今的報告(reporter.html,log.html)打不開了呢? java

   

出現這個問題的緣由是:你升級了jenkins形成的。據官方說明: 安全

   

Jenkins 1.641 / Jenkins 1.625.3 introduce the Content-Security-Policy header to static files served by Jenkins (specifically, DirectoryBrowserSupport). This header is set to a very restrictive default set of permissions to protect Jenkins users from malicious HTML/JS files in workspaces, /userContent, or archived artifacts. 測試

jenkins增長的內容安全策略,默認狀況下,是禁止執行javascript,css等資源的。 ui

   

那麼如何解決呢? google

   

找到jenkins的安裝目錄下的jenkins.xml,修改此文件 spa

修改前 rest

   

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>

   

修改後

   

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' 'unsafe-inline';" -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>

   

必定要重啓jenkins,最好能再執行一下測試腳本,讓它生成新的報告文件就好了。

   

參考連接:

   

https://groups.google.com/forum/#!msg/concordion/RSp92D2CNuc/nwYW4yqvEQAJ

https://kb.froglogic.com/display/KB/Content+Security+Policy+(CSP)+for+Web+Report

相關文章
相關標籤/搜索