问题描述
我正在尝试使用Jenkins在工作中创建自动化构建.我们正在使用SVN进行版本控制.构建成功后,我想发送电子邮件给我的团队,说……X人员已进行了以下更改.
I'm trying to create an automated build at work using Jenkins. We're using SVN for version control. When a build is successful I would like to send an email to my team saying... Person X has committed the following changes.
如何在电子邮件正文中包含提交者名称和最后一个SVN日志条目?我正在使用Jenking email-ext插件.
How can I include the committers name and the last SVN log entry in the body of the email?I'm using the Jenking email-ext plugin.
谢谢!
推荐答案
主题行:
要显示上次构建的提交者,可以将以下内容放入想要的主题行中.请注意,如果自上次构建以来有多个人提交过,则将显示多个名称,因此"%a "
中的(空格).
To display the committer(s) of the last build, you can put the following into the subject line anywhere you want. Do note that if multiple people have committed since the last build, multiple names will be shown, hence the (space) in
"%a "
.
${CHANGES, format="%a "}has/have committed the following changes
Build broken by ${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat="%a "}
不幸的是,如果罪犯的名字在提交消息中多次出现,那么在主题中也将多次出现.
Unfortunately, if a culprit's name appears several times in commit messages, it will appear several times in the subject too.
SVN登录电子邮件
要使SVN登录到电子邮件中,请使用以下命令:
To get the SVN log into the email, I use the following:
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="<b>Changes for Build #%n</b><br>%c<br>", changesFormat="<br>[<a href='${JENKINS_URL}/user/%a/builds'>%a</a>] - (%r) %p<br> %m<br>"}
所有内容都从 Content Token Reference 页面帮助中汇总,经过反复试验.滚动到email-ext
配置的底部,然后单击与 Content Token Reference 文本内联的?
图标(加载可能需要一段时间)
This was all pulled together from the Content Token Reference on-page help with lots of trial and error. Scroll to the bottom of your email-ext
configuration, and click the ?
icon in-line with Content Token Reference text (it may take a while to load)
产生类似于以下内容的输出
Produces output similar to:
内部版本#123的更改
[ commiter_name ]-(1234567)/svn/path/to/changed.files
在此处提交消息
[commiter_name] - (1234567) /svn/path/to/changed.files
Commit message here
这篇关于发送电子邮件时如何在Jenkins中获取SVN日志条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!