简体   繁体   English

Jenkins电子邮件通知变量

[英]Jenkins Email Notification Variables

I tried to trigger an email after build and I found hard to display the build details via my jelly script. 我试图在构建后触发电子邮件,我发现很难通过我的果冻脚本显示构建细节。 I am getting error as "Could not parse jelly script:null" 我收到错误“无法解析果冻脚本:null”

I am getting these issue when I customize this html [ ${JELLY_SCRIPT,template="html"} ] template and run that via server (jenkins_home/email-templates/*.jelly ). 当我自定义这个html [$ {JELLY_SCRIPT,template =“html”}]模板并通过服务器(jenkins_home / email-templates / *。jelly)运行时,我遇到了这些问题。

And I want to get Build Duration, Build Timestamp - Could you let me know how can I achieve this ? 我想获得构建持续时间,构建时间戳 - 你能让我知道如何实现这一目标吗?

In addition , is there any variable defined to get Build status, build artifacts, junit test results ? 另外,是否有任何变量被定义为获取Build状态,构建工件,junit测试结果? eg Like as we use JOB_NAME for getting the project name. 就像我们使用JOB_NAME获取项目名称一样。

Thanks Ashok 谢谢阿肖克

I'll assume you are using the Email-ext plugin for sending mails generated from a jelly script (though you didn't specifically name it). 我假设您正在使用Email-ext插件发送从果冻脚本生成的邮件(尽管您没有具体命名)。

The error indicates that you probably have a null pointer exception somewhere in your script. 该错误表明您的脚本中某处可能存在空指针异常。 A good way to debug jelly scripts is described in this so answer - basically you can use the Jenkins script console to test your template after a modification, without having to run a new build. 这个答案中描述了一种调试果冻脚本的好方法 - 基本上你可以使用Jenkins脚本控制台在修改后测试你的模板,而不必运行新的构建。

To get an idea about how to get specific information, you could look into the default templates (which you probably tried to customize), as well as the jenkins documentation , to see what properties/functions an object has. 要了解如何获取特定信息,您可以查看默认模板(您可能尝试自定义)以及jenkins文档 ,以查看对象具有哪些属性/功能。

The examples you mentioned, like the build duration and timestamp should already appear in the default html template delivered with the plugin, see: 您提到的示例(如构建持续时间和时间戳)应该已经出现在随插件提供的默认html模板中 ,请参阅:

<TR><TD>Date of build:</TD><TD>${it.timestampString}</TD></TR>
<TR><TD>Build duration:</TD><TD>${build.durationString}</TD></TR>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM