首页 新闻 会员 周边 捐助

GitLab持续集成邮件通知问题

0
悬赏园豆:30 [已解决问题] 解决于 2017-02-06 23:58

在 Custom notification events 中已经取消了"Successful pipeline"的选择,但GitLab持续集成功时总是发通知邮件。

请问如何解决这个问题?

dudu的主页 dudu | 高人七级 | 园豆:30778
提问于:2017-02-05 09:19
< >
分享
最佳答案
2

在  /opt/gitlab/embedded/service/gitlab-rails/app/services/notification_service.rb 中,在  pipeline_finished 方法的开头添加  return if pipeline.status == "success" 。

  def pipeline_finished(pipeline, recipients = nil)
    return if pipeline.status == "success"

    email_template = "pipeline_#{pipeline.status}_email"

    return unless mailer.respond_to?(email_template)

    recipients ||= build_recipients(
      pipeline,
      pipeline.project,
      nil, # The acting user, who won't be added to recipients
      action: pipeline.status).map(&:notification_email)

    if recipients.any?
      mailer.public_send(email_template, pipeline, recipients).deliver_later
    end
  end
dudu | 高人七级 |园豆:30778 | 2017-02-06 23:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册