Email-Ext objects in groovy script as file

天大地大妈咪最大 提交于 2019-12-12 02:17:22

问题


My question is kind of a follow up of this: How to place Email-Ext groovy script on the jenkins file system

Here is my situation: I have a groovy script which constructs the email which will be send. This works fine as long as I have the script directly written (the code) in:

Pre-send Script


If I take this script, place it in the Jenkins filesystem(...jenkins\email-templates) as: email-presend.groovy and I try to call it with:

  <presendScript>${SCRIPT, script="email-presend"}</presendScript>

I get the error message, that I can't access the message object:

Script1.groovy: 1: expecting EOF, found 'or' @ line 1, column 17. Error in script or template: groovy.lang.MissingPropertyException: No such property: msg for class: Script1

Code on the line:

  msg.addHeader("X-Priority", "1 (Highest)"); 
  msg.addHeader("Importance", "High"); 

Am I missing something obvious, since I can't find any code snippet which did this? I want to use the javax.mail.Message msg which is available if the code is directly in jenkins.


回答1:


Unfortunately it seems like it's not possible according to this post: Email-ext comment

Too bad :(



来源:https://stackoverflow.com/questions/36572245/email-ext-objects-in-groovy-script-as-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!