Jenkins可编辑的电子邮件通知模板 [英] Jenkins Editable Email Notification Templates

查看:874
本文介绍了Jenkins可编辑的电子邮件通知模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经配置了Jenkins-可编辑的电子邮件通知模板,以便在每次构建后发送自定义的电子邮件.

we have configured Jenkins - Editable Email Notification Templates for sending customized email after every build.

我们做什么:

  1. *Jenkins -> Manage Jenkins -> Editable Email Notification Templates-> Add New Template*下添加了脚本 然后在"Default Content"部分下,我们添加了默认的Groovy脚本(例如:
  1. Added script under *Jenkins -> Manage Jenkins -> Editable Email Notification Templates-> Add New Template* and then under "Default Content" section, we added default groovy scripts (for example: groovy-html.template - Copy paste content). Save.
  2. Now under project job, under Post-build section we selected same template
  3. But when we receive emails, then email is coming without replacing environment variables.. like

 " />     BUILD ${build.result} URL   ${rooturl}${build.url}

Project:  ${project.name} Date:   ${it.timestampString} Duration: ${build.durationString} Cause:  ${cause.shortDescription}

问题:环境变量(例如"build.result","build.url"等)作为变量名(而不是实际值)出现.我们在这里缺少什么吗?

Problem: Environment variable like "build.result", "build.url" etc are coming as variable name (instead of actual values). Are we missing something here?

推荐答案

获得解决方案:) 我们需要在默认内容"部分中将其指定为$ {JELLY_SCRIPT,template ="Jelly脚本名称"} 并将脚本放置在JENKINS主页电子邮件模板"文件夹下

Got the solution:) We need to specify into Default Content section as ${JELLY_SCRIPT,template="Jelly script name"} and place script under JENKINS home "email-templates" folder

这篇关于Jenkins可编辑的电子邮件通知模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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