-->

詹金斯日志分析器插件 - 解析控制台日志页面未显示负载由X框选项否认不允许取景ERR_BLOCKED

2019-09-29 08:48发布

詹金斯版本:1.642.3 2.32.3

詹金斯机的Ubuntu 14.04

日志分析器插件:2.0

浏览詹金斯从我的Mac OS塞拉利昂机。

在詹金斯全局配置,我创建了一个新的条目(说明,以及该文件包含以下内容的文件路径(满))。

error /ERROR: Couldn't find any revision to build./
error /SyntaxError: Use of const in strict mode./
error /svn: E220003: /
error /npm ERR! fetch failed/
error /ERROR: Found inconsistencies/
error /ERROR: svn up failed for /
error /rsync error: /

warning /WARNING: /
warning /npm WARN retry/
warning /svn: E200033: /
warning /: binary operator expected/
warning /: too many arguments/
warning /: No such file or directory/

info /rsync: failed to set times on/
info /svn: E170001: /

我创建了一个测试工作,并捕捉所有这些情况下(如上所列),作业的内部post-build通过选择相同的日志解析文件条目(列表框中选择部分,我启用“控制台输出(构建日志)解析” )。 我跑了构建和预期失败。

Build step 'Console output (build log) parsing' changed build result to FAILURE

在工作中的仪表盘,我看到这一点。

点击所解析的控制台输出 (左侧边栏),带我到一个页面,而不给我任何有意义的信息。

当我将鼠标悬停在上面的侧栏的链接,这表明詹金斯正在寻找的https://.../../parsed_console网址为给定的作业版本号(如上图中的地址栏中看到)。

缺少什么我在这里所有的错误,警告和信息仪表板,像什么这个插件声称这里提供获得解析的控制台输出页面: https://wiki.jenkins.io/download/attachments/43713289/parsed_console_output_3.JPG?版本= 1&时间modificationdate = 1271216347000&API = V2

PS:

在我的$ JENKINS_HOME(上主),插件文件夹下,我看到“登录parser.hpi”文件(最新的文件和SHA与我所看到的,如果我下载我的本地的Mac机上匹配)。 在詹金斯重新启动,我没有看到任何错误日志或者与此相关的插件。

在詹金斯作业的$ JENKINS_HOME / 工作//建立/文件夹中,我看到了有效的日志*与有效大小.html文件(这些都是由这个插件读取显示当你点击“经分析控制台输出”侧栏链接信息。

浏览log_ref.html了有效的链接。

jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ ls -ltr
total 40
-rw-r--r-- 1 jenkins jenkins    6 Aug 21 13:47 changelog.xml
-rw-r--r-- 1 jenkins jenkins 3145 Aug 21 13:47 log_content.html
-rw-r--r-- 1 jenkins jenkins  945 Aug 21 13:47 logwarningLinks.html
-rw-r--r-- 1 jenkins jenkins 4022 Aug 21 13:47 log_ref.html
-rw-r--r-- 1 jenkins jenkins  267 Aug 21 13:47 loginfoLinks.html
-rw-r--r-- 1 jenkins jenkins  277 Aug 21 13:47 log.html
-rw-r--r-- 1 jenkins jenkins 1130 Aug 21 13:47 logerrorLinks.html
-rw-r--r-- 1 jenkins jenkins 2315 Aug 21 13:47 log
-rw-r--r-- 1 jenkins jenkins 1089 Aug 21 13:47 injectedEnvVars.txt
-rw-r--r-- 1 jenkins jenkins 2391 Aug 21 13:47 build.xml
jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ cat -n loginfoLinks.html
     1  <li>1 <a target="content" href="log_content.html#INFO1"><span style="color:blue">rsync: failed to set times on/</span></a></li><br/>
     2  <li>2 <a target="content" href="log_content.html#INFO2"><span style="color:blue">svn: E170001: Auth reqd i guess</span></a></li><br/>
jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ cat -n logwarningLinks.html
     1  HEADER HERE: #0
     2  <li>1 <a target="content" href="log_content.html#WARNING1"><span style="color:orange">WARNING: are not that bad actually</span></a></li><br/>
     3  <li>2 <a target="content" href="log_content.html#WARNING2"><span style="color:orange">npm WARN retry -- won't do any good</span></a></li><br/>
     4  <li>3 <a target="content" href="log_content.html#WARNING3"><span style="color:orange">svn: E200033: db locked again?? no way</span></a></li><br/>
     5  <li>4 <a target="content" href="log_content.html#WARNING4"><span style="color:orange">: binary operator expected -- lol</span></a></li><br/>
     6  <li>5 <a target="content" href="log_content.html#WARNING5"><span style="color:orange">: too many arguments - check the usage please</span></a></li><br/>
     7  <li>6 <a target="content" href="log_content.html#WARNING6"><span style="color:orange">: No such file or directory comes whenever you are looking for something which doesn't exist atm</span></a></li><br/>
jenkins@jenkins-master:/opt/data/jenkins/jobs/testing_log_parser_testing/builds/14$ cat log_ref.html 
<!DOCTYPE html>
<html>
        <head>
                <title>log-parser plugin page</title>
                <link type="text/css" rel="stylesheet" href="https://jenkins-master.company.com/jenkins_instance01/css/style.css" />
                <link type="text/css" rel="stylesheet" href="https://jenkins-master.company.com/jenkins_instance01/css/color.css" />
        </head>
        <body>
<script type="text/javascript">
        function toggleList(list){
                element = document.getElementById(list).style;
                element.display == 'none' ? element.display='block' : element.display='none';
        }
</script>
<img src="https://jenkins-master.company.com/jenkins_instance01///static/a8e7a2ad/images/16x16/red.gif" style="margin: 2px;" width="24" alt="Error Icon" height="24" />
<a href="javascript:toggleList('Error')" target="_self"><STRONG>Error (7)</STRONG></a><br />
<ul id="Error" style="display:none; margin-left:0; padding-left:3em">
 <a target="content" href="log_content.html">Beginning of log</a>
<br/>(7 Errors in this section)<br/>
<li>1 <a target="content" href="log_content.html#ERROR1"><span style="color:red">1 ERROR: Couldn't find any revision to build &lt;= this is an error</span></a></li><br/>
<li>2 <a target="content" href="log_content.html#ERROR2"><span style="color:red">SyntaxError: Use of const in strict mode &lt;= this is another type of error (syntax)</span></a></li><br/>
<li>3 <a target="content" href="log_content.html#ERROR3"><span style="color:red">svn: E220003: Unable to connect to a repository at URL</span></a></li><br/>
<li>4 <a target="content" href="log_content.html#ERROR4"><span style="color:red">svn: E220003: Invalid authz configuration</span></a></li><br/>
<li>5 <a target="content" href="log_content.html#ERROR6"><span style="color:red">npm ERR! fetch failed-- fetch may be?</span></a></li><br/>
<li>6 <a target="content" href="log_content.html#ERROR7"><span style="color:red">ERROR: svn up failed for --- well why not switch to Git/Hg</span></a></li><br/>
</ul>
<img src="https://jenkins-master.company.com/jenkins_instance01///static/a8e7a2ad/images/16x16/yellow.gif" style="margin: 2px;" width="24" alt="Warning Icon" height="24" />
<a href="javascript:toggleList('Warning')" target="_self"><STRONG>Warning (6)</STRONG></a><br />
<ul id="Warning" style="display:none; margin-left:0; padding-left:3em">
 <a target="content" href="log_content.html">Beginning of log</a>
<br/>(6 Warnings in this section)<br/>
<li>1 <a target="content" href="log_content.html#WARNING1"><span style="color:orange">WARNING: are not that bad actually</span></a></li><br/>
<li>2 <a target="content" href="log_content.html#WARNING2"><span style="color:orange">npm WARN retry -- won't do any good</span></a></li><br/>
<li>3 <a target="content" href="log_content.html#WARNING3"><span style="color:orange">svn: E200033: db locked again?? no way</span></a></li><br/>
<li>4 <a target="content" href="log_content.html#WARNING4"><span style="color:orange">: binary operator expected -- lol</span></a></li><br/>
<li>5 <a target="content" href="log_content.html#WARNING5"><span style="color:orange">: too many arguments - check the usage please</span></a></li><br/>
<li>6 <a target="content" href="log_content.html#WARNING6"><span style="color:orange">: No such file or directory comes whenever you are looking for something which doesn't exist atm</span></a></li><br/>
</ul>
<img src="https://jenkins-master.company.com/jenkins_instance01///static/a8e7a2ad/images/16x16/blue.gif" style="margin: 2px;" width="24" alt="Info Icon" height="24" />
<a href="javascript:toggleList('Info')" target="_self"><STRONG>Info (2)</STRONG></a><br />
<ul id="Info" style="display:none; margin-left:0; padding-left:3em">
<li>1 <a target="content" href="log_content.html#INFO1"><span style="color:blue">rsync: failed to set times on/</span></a></li><br/>
<li>2 <a target="content" href="log_content.html#INFO2"><span style="color:blue">svn: E170001: Auth reqd i guess</span></a></li><br/>
</ul>
        </body>
</html>

经过进一步调查,在GitHub的源代码,这个插件(LogParserParser.java文件),我在我的詹金斯作业的$ JENKINS_HOME /工作// //建立文件夹,我发现中log.html可能不正确。 不知道为什么它引用build.log(HREF),同时有在文件系统上没有这样的文件PS: <frame src=....指log_ref和log_content.html文件和它们都呈现细)。

<frameset cols="270,*">
<frame src="log_ref.html" scrolling=auto name="sidebar">
<frame src="log_content.html" scrolling=auto name="content">
<noframes>
<p>Viewing the build report requires a Frames-enabled browser</p>
<a href='build.log'>build log</a>
</noframes>
</frameset>

此行显示的变量parsedLogURL指向log.html。 https://github.com/jenkinsci/log-parser-plugin/blob/1cc883708524e33792d410a109e6cb69a4c0439b/src/main/java/hudson/plugins/logparser/LogParserParser.java#L162

浏览https://<jenkins_server>/<instance>/job/<job_name>/<someBuildNumber>/parsed_console (如由称为Parsed Console Output侧栏链接给任何操作) https://<jenkins_server>/<instance>/job/<job_name>/<someBuildNumber>/parsed_console/log.html (使得只有2个帧,但没有对那些2个帧中的内容(log_ref.html和log_content.html)之间的垂直线BAR(其移动))

在Firefox中:做我的Mac机上检查浏览器的页面为“经分析控制台输出”侧栏的链接(指: https://<jenkins_server>/<instance>/job/<job_name>/<someBuildNumber>/parsed_console )示出了在下面的行Inspect page > Console部分。

Load denied by X-Frame-Options: https://<jenkins_server>/<jenkins_instance>/job/<job_name>/<build_number>/parsed_console/log.html does not permit framing.  (unknown)

如果我浏览https://<jenkins_server>/<instance>/job/<job_name>/<someBuildNumber>/parsed_console/log.html ,然后我得到了以下几行Inspect page > Console窗口:

https://<jenkins_server>/<jenkins_instance>/job/<job_name>/<build_number>/parsed_console/log_ref.html does not permit framing.  (unknown)
Load denied by X-Frame-Options: https://<jenkins_server>/<jenkins_instance>/job/<job_name>/<build_number>/parsed_console/log_content.html does not permit framing.  (unknown)

在Chrome中,做Inspect的页面上,显示了以下错误(拒绝了,因为它设置为显示/帧“X-框架-选项”到“拒绝” /网:: ERR_BLOCKED_BY_RESPONSE):

Refused to display 'https://<jenkins_server>/<jenkins_instance>/job/<jobname>/15/parsed_console/job/<jobname>/15/parsed_console/log.html' in a frame because it set 'X-Frame-Options' to 'deny'.
(index):22 GET https://<jenkins_server>/<jenkins_instance>/job/<jobname>/15/parsed_console/job/<jobname>/15/parsed_console/log.html net::ERR_BLOCKED_BY_RESPONSE

Answer 1:

这个问题是不与插件。

使用Inspect网页上,很明显,一些被设置在任的Apache / Nginx的否认。

我修改了我的/etc/nginx/sites-enabled/jenkins_https.conf文件

   #add_header X-Frame-Options DENY;

sudo service nginx restart

插件现在显示输出的预期。

另一种更好的解决方案是:

替换下面的行

#add_header X-Frame-Options DENY;

在你的nginx的配置文件中的以下行:

add_header X-Frame-Options SAMEORIGIN;

参考文献: https://geekflare.com/add-x-frame-options-nginx/或https://www.owasp.org/index.php/Clickjacking_Defense_Cheat_Sheet



文章来源: Jenkins Log parser plugin - parsed console log page is not showing Load denied by X-Frame-Options does not permit framing ERR_BLOCKED_BY_RESPONSE