Hashar has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/376739 )
Change subject: zuul: allow email connection
......................................................................
zuul: allow email connection
We had a few requests to run some CI jobs periodically and, on failure,
report by email. We cant really do it in the Jenkins job since it would
always report.
Add some smtp/email configuration to the Zuul server so we can report
those periodic jobs.
Bug: T93414
Change-Id: I60126d823490df0632ec72042be0cd7493b90cdd
---
M modules/role/manifests/zuul/server.pp
M modules/zuul/manifests/server.pp
A modules/zuul/spec/classes/zuul_server_spec.rb
M modules/zuul/templates/zuul.conf.erb
4 files changed, 49 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/39/376739/1
diff --git a/modules/role/manifests/zuul/server.pp
b/modules/role/manifests/zuul/server.pp
index df97f01..4484908 100644
--- a/modules/role/manifests/zuul/server.pp
+++ b/modules/role/manifests/zuul/server.pp
@@ -25,6 +25,9 @@
url_pattern => $conf_server['url_pattern'],
status_url => $conf_server['status_url'],
statsd_host => $conf_server['statsd_host'],
+
+ # Enable email configuration
+ email_server => $::mail_smarthost[0],
}
# Deploy Wikimedia Zuul configuration files.
diff --git a/modules/zuul/manifests/server.pp b/modules/zuul/manifests/server.pp
index 5235c51..c1863c2 100644
--- a/modules/zuul/manifests/server.pp
+++ b/modules/zuul/manifests/server.pp
@@ -41,6 +41,10 @@
$gerrit_baseurl = 'https://gerrit.wikimedia.org/r',
$gerrit_event_delay = '5',
$status_url = "https://${::fqdn}/zuul/status",
+ $email_server = undef,
+ $email_server_port = 25,
+ $email_default_from = '[email protected]',
+ $email_default_to = '[email protected]',
) {
require ::zuul
diff --git a/modules/zuul/spec/classes/zuul_server_spec.rb
b/modules/zuul/spec/classes/zuul_server_spec.rb
new file mode 100644
index 0000000..b6681b0
--- /dev/null
+++ b/modules/zuul/spec/classes/zuul_server_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+describe 'zuul::server' do
+ let(:facts) { {
+ # for wmflib os_version
+ :operatingsystem => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistrelease => '8.7',
+ } }
+ let(:params) { {
+ :gerrit_server => 'review.example.org',
+ :gerrit_user => 'ci-bot',
+ :gearman_server => '127.0.0.1',
+ :gearman_server_start => true,
+ :url_pattern => 'https://ci.example.org/job/{job.name}',
+ } }
+ it "should compile" do
+ should contain_file('/etc/zuul/zuul-server.conf')
+ .without_content(/\[merger\]/)
+ .without_content(/^\[connection smtp\]$/)
+ end
+
+ context 'when email_server is set' do
+ let(:params) {
+ super().merge({ :email_server => 'mx01.example.org' })
+ }
+ it "should have have a smtp connection defined" do
+ should contain_file('/etc/zuul/zuul-server.conf')
+ .with_content(/^\[connection smtp\]$/)
+ .with_content(/^server=mx01\.example\.org$/)
+ end
+ end
+end
diff --git a/modules/zuul/templates/zuul.conf.erb
b/modules/zuul/templates/zuul.conf.erb
index 901fd58..73d9962 100644
--- a/modules/zuul/templates/zuul.conf.erb
+++ b/modules/zuul/templates/zuul.conf.erb
@@ -46,3 +46,12 @@
git_user_name=<%= @git_name %>
<% end -%>
<% end -%>
+
+<% if @zuul_role == 'server' && ! @email_server.nil? -%>
+[connection smtp]
+driver=smtp
+server=<%= @email_server %>
+port=<%= @email_server_port %>
+default_from=<%= @email_default_from %>
+default_to=<%= @email_default_to %>
+<% end -%>
--
To view, visit https://gerrit.wikimedia.org/r/376739
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I60126d823490df0632ec72042be0cd7493b90cdd
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits