移动测试基础 jenkins 可以实现构建失败发邮件给提交代码的人么

清风上灬 · 2018年01月05日 · 最后由 骷髅弓箭手 回复于 2018年08月30日 · 1983 次阅读

如图

共收到 8 条回复 时间 点赞

可以,加 hook

恒温 回复

大神 我是菜鸟 能稍微详细点么

Send to Developers(发送给开发,谁 check in 就发送给谁)

有插件的

http://blog.csdn.net/hwhua1986/article/details/47975257

恒温 回复

谢谢大神我试试看

发送邮件的代码是使用 groovy 实现的,所有的内容,接收者都可以在 pre-send 中进行修改。
我当前的实现方法是使用 groovy 正则提取出 git commit 中的提交者,然后配置到接收者中。

def git_log = "git log".execute([], new File("you/job/path")).text
def m = git_log =~ /Author: (.*) <(.*)>\n/
def author = m[0][2]
msg.setRecipients(Message.RecipientType.TO, "$author")

希望对你有帮助。


问下我这边上传 apk 到 fir 提示上传成功,邮件也提示发成功,怎么没收到邮件,fir 上传没有问题

大佬~
def git_log = "git log".execute([], new File("you/job/path")).text 这一行是什么意思啊?我在 pipeline groovy 脚本中写了这些,报错了构建失败
大概是下面这样
node('master') {
def git_log = "git log".execute([], new File("you/job/path")).text
def m = git_log =~ /Author: (.) <(.)>\n/
def author = m[0][2]
try {
}catch(err){
}finally{
if (currentBuild.result == 'FAILURE') {
mail to: "${author}"
}
}
}
报错:org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new java.io.File java.lang.String

需要添加权限,系统管理->In-process Script Approval。里面应该有你报错的 new java.io.File java.lang.String 这两个类。直接点击 approve 之后应该就可以用了。

需要 登录 後方可回應,如果你還沒有帳號按這裡 注册