如何在Jenkins Email-Ext中引用groovy脚本

问题描述 投票:0回答:1

如果groovy脚本输出为true,我需要触发电子邮件通知,我通过添加脚本 - 在构建触发器到Email-Ext触发器之后执行此操作并将我的脚本作为${SCRIPT, template="myscript.groovy"}放入脚本 - 构建后 - > Groovy脚本块,保存此配置后我收到了这个错误。

startup failed:
Script1.groovy: 1: unexpected token: SCRIPT @ line 1, column 3.
   ${SCRIPT, template="myscript.groovy"}
     ^

1 error 

我从Email-ext网站得到了这个

使用脚本标记,模板参数等于模板文件名,或者脚本参数等于自定义脚本名称。例如,如果模板文件名为foobar.template,则电子邮件内容将类似于$ {SCRIPT,template =“foobar.template”}。

https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin#Email-extplugin-Scriptcontent

jenkins groovy email-ext
1个回答
0
投票

我自己找到了答案,事实证明该块不是用于脚本引用,而是用于脚本,我将Groovy脚本放在该块中并且它有效。

© www.soinside.com 2019 - 2024. All rights reserved.