如何在Jenkins电子邮件中包含git changelog? [英] How to include git changelog in Jenkins emails?

查看:887
本文介绍了如何在Jenkins电子邮件中包含git changelog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将Jenkins生成的更改日志导入电子邮件主题(通过默认电子邮件或 email-ext plugin )?



我是Jenkins配置的新手,所以我很抱歉,如果这是一个简单的问题,但是我无法在email-ext文档中找到任何内容。 >

解决方案

我配置了我的Email-ext插件以使用CHANGES令牌(这里的官方文档):

 更改: 
$ {CHANGES,showPaths = true,format =%a:%r%p \\\
- \%m\,pathFormat =\\\
\t-%p

在我的构建通知中打印以下内容:

 更改:
用户名:1​​23
- 项目/ Filename1.m
- 项目/ Filename2.m
- 我的日志消息

对于HTML消息,我将相同的代码放在div中并添加了格式: p>

 < div style =padding-left:30px; padding-bottom:15px;> 
$ {CHANGES,showPaths = true,format =< div>< b>%a< / b> ;:%r%p< / div>< div style = \padding-left :30px; \>&#8212;&#8220;< em>%m< / em>&#8221;< / div>,pathFormat =< / div> div style = \padding-left:30px; \>%p}
< / div>

这是一个关于Jenkins发送的电子邮件如何显示的截图提交来自Subversion,但Git和其他版本控制系统的工作原理相同):




Is there any way to import the changelog that is generated by Jenkins to the subject of an email (either through the default email, or the email-ext plugin)?

I am new to Jenkins configuration, so I apologize if this is a simple issue, but I was not able to find anything on the email-ext documentation.

解决方案

I configured my Email-ext plug-in to use the CHANGES Token (official documentation here):

Changes:
${CHANGES, showPaths=true, format="%a: %r %p \n--\"%m\"", pathFormat="\n\t- %p"}

That prints the following in my build notifications:

Changes:
Username: 123
    - Project/Filename1.m
    - Project/Filename2.m
    -- "My log message"

For HTML messages, I placed the same code within a div and added formatting:

<div style="padding-left: 30px; padding-bottom: 15px;">
${CHANGES, showPaths=true, format="<div><b>%a</b>: %r %p </div><div style=\"padding-left:30px;\"> &#8212; &#8220;<em>%m</em>&#8221;</div>", pathFormat="</div><div style=\"padding-left:30px;\">%p"}
</div>

Here's a sample screenshot of how it looks in the e-mails sent out by Jenkins now (this particular commit came from Subversion, but it works exactly the same for Git and other version control systems):

这篇关于如何在Jenkins电子邮件中包含git changelog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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