如何配置jenkins作业以在SCM提交时发送邮件 [英] How to configure a jenkins job to send mail if a SCM commit

查看:1216
本文介绍了如何配置jenkins作业以在SCM提交时发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在配置需要执行以下任务的jenkins作业时遇到问题:




  • 每30分钟安排一次=> OK

  • 执行更新(CVS,SVN,...)=> OK

  • 如果在SCM中检测到更改,请发送电子邮件repo => KO



所以我的工作配置如下:




  • 源代码管理:cvs root / branch / ...

  • 构建触发器:Poll SCM:* / 30 * * * *

  • Build:No buils step

  • 后期构建操作:电子邮件通知





任何提示?

解决方案

简短答案:添加类型为Always(或Before Build或类似于以下列表中的其他触发器)的email-ext触发器。 b
$ b

jenkins email-ext插件。
https://wiki.jenkins-ci.org/display / JENKINS / Email-ext + plugin
阅读关于触发器
'''默认情况下,配置的唯一触发器是Failure触发器。要添加更多触发器,请从下拉菜单中选择一个,然后将其添加到列表中。


  1. 电子邮件通知 - 选择高级框。添加电子邮件触发器。例如触发器列表:



中止
总是
在构建之前
失败 - >不稳定(测试失败)
失败 - 任何
失败 - 第一
失败 - 第二
失败 - 仍然
固定
未构建
脚本 - 之后构建
脚本 - 构建之前
状态已更改
成功
测试改进
测试回归
不稳定(测试失败) - 首先
不稳定失败) - 仍然
不稳定(测试失败)
不稳定(测试失败)/失败 - >成功



< 2>

  • 您还可以选择和配置谁收到电子邮件。选择在构建之前触发器并选择发送到列表。发送到列表选项例如



  •  Culprits 
    开发人员
    收件人列表
    请求者
    疑似构建失败
    疑犯测试失败
    上传提交程序

    电子邮件列表在一般jenkins配置中配置。



    这个答案涉及到这个问题的主题:在每个版本上从Jenkins email-ext向发件人发送电子邮件


    I have problems with configuring a jenkins job that need to do the following task :

    • scheduled every 30 minutes => OK
    • do an update (CVS, SVN, ...) => OK
    • send an email if a change is detected in the SCM repo => KO

    So my job is configured as follow :

    • Source Code Management : cvs root / branch / ...
    • Build Triggers : Poll SCM : */30 * * * *
    • Build : No buils step
    • Post-build Actions : E-mail Notification

    But I received emails only when the build failed and not when an update is detected.

    Any hint ?

    解决方案

    Short answer: add an email-ext trigger of type "Always" (or "Before Build" or from other triggers e.g. in list below).

    jenkins email-ext plugin. https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin Read about Triggers '''By default, the only trigger configured is the "Failure" trigger. To add more triggers, select one from the dropdown, and it will be added to the list.'''

    1. In job configuration - Editable Email Notification - select Advanced box. Add an email Trigger. e.g. list of triggers:

    Aborted
    Always
    Before Build
    Failure -> Unstable (Test Failures)
    Failure - Any
    Failure - First
    Failure - Second
    Failure - Still
    Fixed
    Not Built
    Script - After Build
    Script - Before Build
    Status Changed
    Success
    Test Improvement
    Test Regression
    Unstable (Test Failures) - First
    Unstable (Test Failures) - Still
    Unstable (Test Failures)
    Unstable (Test Failures)/Failure -> Success
    

    1. You may also select and configure who gets the emails. Select "Before Build" trigger and choose "Sent To" list. Send To lists choice e.g.

    Culprits 
    Developers 
    Recipient List 
    Requestor 
    Suspects build fail
    Suspects tests fail
    Upstream Committers
    

    The email lists are configured in the general jenkins configuration.

    This answer touches on the topic of this question: Send email to commiters from Jenkins email-ext on every build

    这篇关于如何配置jenkins作业以在SCM提交时发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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