Jenkins 可编辑电子邮件通知模板

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

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

我们做了什么

  1. *Jenkins -> Manage Jenkins -> Editable Email Notification Templates-> Add New Template*
    下添加了脚本 然后在
    "Default Content"
    部分下,我们添加了默认的 groovy 脚本(例如: groovy-html.template - 复制粘贴内容)。保存。
  2. 现在在项目作业下,在构建后部分我们选择了相同的模板
  3. 但是当我们收到电子邮件时,电子邮件就会在不替换环境变量的情况下到来..就像
 " />     BUILD ${build.result} URL   ${rooturl}${build.url}

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

问题:“build.result”、“build.url”等环境变量以变量名称(而不是实际值)的形式出现。我们在这里遗漏了什么吗?

jenkins jenkins-plugins
2个回答
5
投票

我们需要在默认内容部分指定为

${JELLY_SCRIPT,template="Jelly script name"}

并将脚本放在 JENKINS 主目录的“email-templates”文件夹下。


0
投票

我用 ${script,template="email-body.groovy"} 指定,但我在电子邮件正文中收到了 html 内容。如何获得表体中的内容? This type of html content received in my mail body

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