詹金斯:$ {BUILD_LOG,maxLines,escapeHtml}无法正常工作 [英] Jenkins: ${BUILD_LOG, maxLines, escapeHtml} not working

查看:451
本文介绍了詹金斯:$ {BUILD_LOG,maxLines,escapeHtml}无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用$ {BUILD_LOG,maxLines,escapeHtml},如下所述:
如何从$ BUILD_LOG变量中获取最后20行?



不幸的是,它不适合我。



我得到这个错误:


Script1.groovy:114:期待任何事但''\ n'';
由用户MYUSERNAME制作


我在这行中的代码是: p>

  msg.setText(This build(+ build.getFullDisplayName()
+)包含以下任务:\\ \\ n \TASK \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\ n $ {BUILD_LOG,maxLines = 9999,escapeHtml = false});






如果我将以下内容展示出来, 。这就是为什么我的猜测是, BUILD_LOG 不再适用?
$ b


$ {BUILD_LOG,maxLines = 9999,escapeHtml = false}






编辑:
也许作为补充:我正在尝试使用PreSend groovy脚本来做到这一点。
由于我正在动态地构建电子邮件文本。
$ {BUILD_URL} 正常工作, $ {BUILD_LOG,maxLines = 9999,escapeHtml = false} doesn 't(对我来说)我正在寻找一个解决方案...
msg object是一个java MimeMessage。



感谢,
Daniel

解决方案

该错误信息通常与未结束引号有关,注释以 / 而不是 // 等等开头。在你的代码中,我能看到的唯一的事情就是你的第三个行没有正确完成,即在\\\
\\\
\\\
链接到这个
之后,你没有关闭双引号,而是开始一个新行(从而期望除''\ n''之外的任何内容



尝试写出整行:

  msg.setText(This build(+ build.getFullDisplayName()
+)包含以下任务:\ n \TASK \\\\\\\\\\\\\\\\\\\\\\\' \\\
\\\
\\\
链接到此版本:$ {BUILD_URL} \ $ $ {BUILD_LOG,maxLines = 9999,escapeHtml = false});

或者结束引号:

<$ p (+ build.getFullDisplayName()
+)包含以下任务:\\\
\\\
TASK\t\t\ t IMPLEMENTER:\\\

+ taskList +\\\
\\\
\\\
链接到这个
+build:$ {BUILD_URL} \ $ $ {BUILD_LOG,maxLines = 9999, escapeHtml = false});


I am trying to use "${BUILD_LOG, maxLines, escapeHtml}" like discribed in: How can I take last 20 lines from the $BUILD_LOG variable?

Unfortunately it doesn't work for me.

I get this error:

Script1.groovy: 114: expecting anything but ''\n''; got it anyway @ line 114, column 301. arted by user MYUSERNAME

My code in this line is:

          msg.setText("This build (" + build.getFullDisplayName() 
          + " ) contains the following tasks:\n\nTASK\t\t\t  IMPLEMENTER:\n" 
          + taskList + "\n\n\nLink to this 
          build: ${BUILD_URL} \n ${BUILD_LOG, maxLines=9999, escapeHtml=false}" );


If I take this out the following, it works. Thats why my guess is, that "BUILD_LOG" is not working anymore?

${BUILD_LOG, maxLines=9999, escapeHtml=false}


EDIT: Maybe as addition: I am trying to do this withing the PreSend groovy script. Since I am building the Email text dynamically. ${BUILD_URL} works fine, ${BUILD_LOG, maxLines=9999, escapeHtml=false} doesn't (for me) i am looking for a solution for this... the msg object is a java MimeMessage.

Thanks, Daniel

解决方案

That error message is usually related to not closed quotes, comments started with / instead of //, etc. In your code the only thing I can see is that your third line is not finished properly, i.e., after "\n\n\nLink to this you are not closing double quotes and instead you are starting a new line (thereby the expecting anything but ''\n''.

Try to write the whole line:

msg.setText("This build (" + build.getFullDisplayName() 
          + " ) contains the following tasks:\n\nTASK\t\t\t  IMPLEMENTER:\n" 
          + taskList + "\n\n\nLink to this build: ${BUILD_URL} \n ${BUILD_LOG, maxLines=9999, escapeHtml=false}" );

or close the quotes instead:

msg.setText("This build (" + build.getFullDisplayName() 
          + " ) contains the following tasks:\n\nTASK\t\t\t  IMPLEMENTER:\n" 
          + taskList + "\n\n\nLink to this "
          + "build: ${BUILD_URL} \n ${BUILD_LOG, maxLines=9999, escapeHtml=false}" );

这篇关于詹金斯:$ {BUILD_LOG,maxLines,escapeHtml}无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆