Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: ${BUILD_LOG, maxLines, escapeHtml} not working

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

like image 398
Beasly Avatar asked Sep 21 '15 13:09

Beasly


1 Answers

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}" );
like image 144
jalopaba Avatar answered Nov 04 '22 13:11

jalopaba