Last modified: 2014-01-09 18:52:39 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57824, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55824 - Customize Jenkins email notifications
Customize Jenkins email notifications
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Quality Assurance (Other open bugs)
wmf-deployment
All All
: Unprioritized normal (vote)
: ---
Assigned To: Geoffrey Mon
https://www.google-melange.com/gci/ta...
gci2013 https://www.mediawiki.org/wik...
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-17 04:30 UTC by Jon
Modified: 2014-01-09 18:52 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
typical Jenkins report (10.14 KB, message/rfc822)
2013-11-26 18:16 UTC, Željko Filipin
Details
Progress on email-ext customization (3.69 KB, text/html)
2013-12-01 00:03 UTC, Geoffrey Mon
Details
First version of jenkins template ready for testing (4.29 KB, text/plain)
2013-12-03 04:53 UTC, Geoffrey Mon
Details
Example html 2 (3.72 KB, text/html)
2013-12-03 21:51 UTC, Geoffrey Mon
Details
Template v1.1 (3.76 KB, text/plain)
2013-12-04 02:41 UTC, Geoffrey Mon
Details
Example html 3 (3.28 KB, text/html)
2013-12-04 02:45 UTC, Geoffrey Mon
Details
e-mail notification with failed tests (14.12 KB, message/rfc822)
2013-12-04 14:17 UTC, Željko Filipin
Details
how e-mail notification after failed test should look like (27.52 KB, image/png)
2013-12-05 15:15 UTC, Željko Filipin
Details
Final email template (for now) (3.91 KB, text/plain)
2013-12-06 23:18 UTC, Geoffrey Mon
Details
before (16.43 KB, message/rfc822)
2013-12-10 14:22 UTC, Željko Filipin
Details
after (17.33 KB, message/rfc822)
2013-12-10 14:23 UTC, Željko Filipin
Details

Description Jon 2013-10-17 04:30:56 UTC
Could we use the same subject heading for these emails so they grouped
into one thread? e.g. QA Report and move the current subject into the
email body itself?

Currently I am getting lots of mails in the form:
Build failed in Jenkins: MobileFrontend-en.m.wikipedia.org-linux-firefox #97

and it is very hard to group and filter them.

As a result I tend to ignore them due to too much noise which is bad :).
Comment 1 Željko Filipin 2013-10-22 05:22:41 UTC
We should find a Jenkins plugin that should allow us to customize e-mail notification messages. The default messages are not really useful.
Comment 2 Jeff Hall 2013-11-26 16:43:27 UTC
I used this plugin in a previous job and found it to be very flexible (among other things, it provides for customized e-mail subject strings):

https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
Comment 3 Željko Filipin 2013-11-26 18:15:00 UTC
This is how a typical Jenkins report looks like (see attached file).
Comment 4 Željko Filipin 2013-11-26 18:16:23 UTC
Created attachment 13911 [details]
typical Jenkins report
Comment 5 Željko Filipin 2013-11-26 18:18:28 UTC
If you do not have an e-mail client, this is how an e-mail notification for a failed Jenkins job looks like:



From: jenkins-no-reply@cloudbees.com 
To:  
Date: Tue, 26 Nov 2013 19:02:57 +0100 
Subject: Build failed in Jenkins: VisualEditor-en.wikipedia.beta.wmflabs.org-linux-firefox #172 
 
See <https://wmf.ci.cloudbees.com/job/VisualEditor-en.wikipedia.beta.wmflabs.org-linux-firefox/172/changes>

Changes:

[roan.kattouw] Share code between conflict resolution and the edit source switch

[roan.kattouw] Don't build out save dialog when initializing editor

[roan.kattouw] Use InputWidget facilities in byte limit counter

[krinklemail] Remove the toolbar tracker

------------------------------------------
Started by user Chris Mcmahon
Building remotely on s-e4476767 in workspace <https://wmf.ci.cloudbees.com/job/VisualEditor-en.wikipedia.beta.wmflabs.org-linux-firefox/ws/>
Cloning the remote Git repository
Cloning repository https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
git --version
git version 1.7.11.7
Checking out Revision 07464e20a535fe1efdbd7f8e862ff8f7b3825722 (origin/master)
[VisualEditor-en.wikipedia.beta.wmflabs.org-linux-firefox] $ /bin/sh -xe /tmp/hudson495896231200628031.sh
+ export MEDIAWIKI_USER=Selenium_user
+ MEDIAWIKI_USER=Selenium_user
+ export MEDIAWIKI_PASSWORD_VARIABLE=MEDIAWIKI_PASSWORD_SELENIUM_USER_WMFLABS_ORG
+ MEDIAWIKI_PASSWORD_VARIABLE=MEDIAWIKI_PASSWORD_SELENIUM_USER_WMFLABS_ORG
+ export BROWSER_LABEL=firefox
+ BROWSER_LABEL=firefox
+ export MEDIAWIKI_URL=http://en.wikipedia.beta.wmflabs.org/wiki/
+ MEDIAWIKI_URL=http://en.wikipedia.beta.wmflabs.org/wiki/
+ curl -s -o use-ruby https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/ruby/use-ruby
+ RUBY_VERSION=2.0.0-p247
+ source ./use-ruby
++ [[ -z 2.0.0-p247 ]]
++ ruby187='1.8.7-*'
++ [[ 2.0.0-p247 == 1.8.7-* ]]
++ BASE=/scratch/jenkins/addons
++ mkdir -p /scratch/jenkins/addons
++ '[' '!' -f /scratch/jenkins/addons/use.sh ']'
++ wget -q -P /scratch/jenkins/addons https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/lib/use.sh
++ . /scratch/jenkins/addons/use.sh
++ mkdir -p /scratch/jenkins/addons/ruby
+++ addon_architecture
+++ uname -m
++ ruby_name=ruby-2.0.0-p247-x86_64
++ '[' '!' -f /scratch/jenkins/addons/ruby/ruby-2.0.0-p247-x86_64.tar.bz2 ']'
+++ addon_platform
++++ head -n 1
++++ cat /etc/issue
+++ issue='Fedora release 17 (Beefy Miracle)'
+++ fedora_regex='Fedora release 17*'
+++ [[ Fedora release 17 (Beefy Miracle) == Fedora release 17* ]]
+++ echo fc17
+++ return
++ wget -q -P /scratch/jenkins/addons/ruby https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/ruby/fc17/ruby-2.0.0-p247-x86_64.tar.bz2
++ '[' '!' -f /scratch/jenkins/addons/ruby/ruby-2.0.0-p247-x86_64/bin/ruby ']'
++ tar xjf /scratch/jenkins/addons/ruby/ruby-2.0.0-p247-x86_64.tar.bz2 -C /scratch/jenkins/addons/ruby
++ export RUBY_HOME=/scratch/jenkins/addons/ruby/ruby-2.0.0-p247-x86_64
++ RUBY_HOME=/scratch/jenkins/addons/ruby/ruby-2.0.0-p247-x86_64
++ export PATH=/scratch/jenkins/addons/ruby/ruby-2.0.0-p247-x86_64/bin:/opt/jdk/latest/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/opt/maven/latest/bin:/opt/ant/latest/bin:/opt/android/android-sdk-linux/tools:/opt/gradle/latest/bin:/home/jenkins/bin:/opt/jdk/jdk.latest/bin
++ PATH=/scratch/jenkins/addons/ruby/ruby-2.0.0-p247-x86_64/bin:/opt/jdk/latest/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/opt/maven/latest/bin:/opt/ant/latest/bin:/opt/android/android-sdk-linux/tools:/opt/gradle/latest/bin:/home/jenkins/bin:/opt/jdk/jdk.latest/bin
++ unset GEM_PATH
++ unset GEM_HOME
++ unset BUNDLE_PATH
+ gem install bundler --no-ri --no-rdoc
Successfully installed bundler-1.3.5
1 gem installed
+ '[' -d modules/ve-mw/test/browser/ ']'
+ cd modules/ve-mw/test/browser/
+ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Installing builder (3.2.2) 
Installing ffi (1.9.3) 
Installing childprocess (0.3.9) 
Installing diff-lcs (1.2.4) 
Installing multi_json (1.8.2) 
Installing gherkin (2.12.2) 
Installing multi_test (0.0.2) 
Installing cucumber (1.3.8) 
Installing i18n (0.6.5) 
Installing faker (1.2.0) 
Installing yml_reader (0.2) 
Installing data_magic (0.16.1) 
Installing json (1.8.1) 
Installing net-http-persistent (2.9) 
Installing page_navigation (0.9) 
Installing rubyzip (1.0.0) 
Installing websocket (1.0.7) 
Installing selenium-webdriver (2.37.0) 
Installing watir-webdriver (0.6.4) 
Installing page-object (0.9.3) 
Installing mime-types (2.0) 
Installing rest-client (1.6.7) 
Installing rspec-expectations (2.14.3) 
Installing syntax (1.0.0) 
Installing mediawiki-selenium (0.1.12) 
Using bundler (1.3.5) 
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
+ bundle exec cucumber --verbose --profile ci --tags @en.wikipedia.beta.wmflabs.org
Code:
  * features/support/env.rb
  * features/support/hooks.rb
  * features/support/modules/url_module.rb
  * features/support/pages/cursor_test_page.rb
  * features/support/pages/login_page.rb
  * features/support/pages/visual_editor_page.rb
  * features/step_definitions/bullets_steps.rb
  * features/step_definitions/common_steps.rb
  * features/step_definitions/cursor_steps.rb
  * features/step_definitions/general_markup_steps.rb
  * features/step_definitions/headings_steps.rb
  * features/step_definitions/links_steps.rb
  * features/step_definitions/references_steps.rb
  * features/step_definitions/shared_steps.rb
  * features/step_definitions/transclusion_steps.rb

Features:
  * features/bullets.feature
  * features/edit_utf8_logged_in.feature
  * features/general_markup.feature
  * features/headings.feature
  * features/indent_outdent.feature
  * features/links.feature
  * features/references.feature
  * features/transclusion.feature
Parsing feature files took 0m0.111s

Build step 'Execute shell' marked build as failure
Recording test results
Comment 6 Željko Filipin 2013-11-26 18:21:32 UTC
From what I understand, the people would like the e-mail notification to look similar to this page:

https://wmf.ci.cloudbees.com/view/r-ve/job/VisualEditor-en.wikipedia.beta.wmflabs.org-linux-chrome/164/
Comment 7 Arthur Richards 2013-11-26 20:45:34 UTC
(In reply to comment #6)
> From what I understand, the people would like the e-mail notification to look
> similar to this page:
> 
> https://wmf.ci.cloudbees.com/view/r-ve/job/VisualEditor-en.wikipedia.beta.
> wmflabs.org-linux-chrome/164/

Yeah, that would be *much* more useful. It would also be nice to still get the recent changes that were checked in like in the current mail, eg:

Changes:

[roan.kattouw] Share code between conflict resolution and the edit source
switch

[roan.kattouw] Don't build out save dialog when initializing editor

[roan.kattouw] Use InputWidget facilities in byte limit counter

[krinklemail] Remove the toolbar tracker

And if they could provide links to changesets gerrit, that would be even better :)

It would also be good if there was a direct link provided to the build in jenkins.
Comment 8 Geoffrey Mon 2013-11-27 17:17:35 UTC
Hey, I'm GEOFBOT from GCI!  I think I'll try out this task, but I have no clue how to start out.  Where should I start out?
Comment 9 Željko Filipin 2013-11-27 19:32:40 UTC
Hi Geoffrey and welcome!

For future reference, if you get stuck you can ask questions here, at #wikimedia-qa freenode IRC channel or at QA mailing list[1].

To answer your question, start with either installing Jenkins[2] on your local machine or create a free account at a hosted Jenkins service, like Cloudbees[3].

When you have a test Jenkins instance, create a few jobs and start sending e-mail notifications to your e-mail.

Then install the plugin[4] Jeff has suggested and try changing the e-mail notifications so they look more like this report[5].

If you get stuck, or if you have any questions, let us know.

1: https://lists.wikimedia.org/mailman/listinfo/qa
2: http://jenkins-ci.org/
3: http://www.cloudbees.com/
4: https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
5: https://wmf.ci.cloudbees.com/view/r-ve/job/VisualEditor-en.wikipedia.beta.wmflabs.org-linux-chrome/164/
Comment 10 Geoffrey Mon 2013-11-29 14:37:35 UTC
Cloudbees URL: https://geofbot.ci.cloudbees.com/job/test/
Comment 11 Željko Filipin 2013-11-29 15:58:50 UTC
Geoffrey, this might be the problematic part: "Have your Jenkins administrator place the script inside JENKINS_HOME\email-templates." (from plugin documentation[1]).

You should contact cloudbees support and ask how to do it.

1: https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
Comment 12 Geoffrey Mon 2013-11-30 03:34:27 UTC
Progress!

I managed to extract the first line of console output to find who started the job.  It took a lot of guesswork (I have never coded in Groovy before, especially not within a HTML :P)
Comment 13 Željko Filipin 2013-11-30 14:28:42 UTC
Geoffrey, feel free to attach the e-mail to this bug, or to send it to me, so I could take a look.
Comment 14 Geoffrey Mon 2013-12-01 00:03:09 UTC
Created attachment 13947 [details]
Progress on email-ext customization
Comment 15 Geoffrey Mon 2013-12-03 04:53:56 UTC
Created attachment 13967 [details]
First version of jenkins template ready for testing

1. To use this template, place it under $JENKINS_HOME/email-templates/
2. make sure email-ext plugin is installed
3. Under the job config for post-build actions, remove "email notification" and add "editable email notification"
4. Change default content type to html
5. Change body to ${SCRIPT, template="wikimedia-jenkins.template-1"}
6. Optional - change the subject using the token references; here is the one i used: ${PROJECT_NAME} ${BUILD_NUMBER} - ${BUILD_STATUS}
7. Set the recipients, etc.
8. Open Advanced Settings... and there you can change when an email notification is triggered.
Comment 16 Željko Filipin 2013-12-03 14:20:08 UTC
Geoffrey, can you attach an example e-mail, so we can see if the template does what we need?
Comment 17 Geoffrey Mon 2013-12-03 21:51:16 UTC
Created attachment 13971 [details]
Example html 2

I don't have tests set up on my jenkins, so unfortunately I couldn't test that aspect of the template

I replaced all of the LAN image references with a cloudbees link so they would work, but the links to the build will be broken.
Comment 18 Geoffrey Mon 2013-12-04 02:41:54 UTC
Created attachment 13975 [details]
Template v1.1

Better version with some bugs ironed out

Would be nice if someone tested out the "tests" part of it because I don't have tests set up for my local jenkins build.
Comment 19 Geoffrey Mon 2013-12-04 02:45:39 UTC
Created attachment 13976 [details]
Example html 3

The example html for template 1.1
Comment 20 Željko Filipin 2013-12-04 14:16:41 UTC
Geoffrey,

I did not want to mess up existing job (test), so I have created another one (test2). Short documentation on how to set up a job to run tests is available[1]. I have cloned browsertests[2] repository and the job runs tests from login.feature[3] file. I will attach e-mail that was sent after the job failed.

1: https://github.com/wikimedia/mediawiki-selenium/blob/master/docs/job.md
2: https://github.com/wikimedia/qa-browsertests
3: https://github.com/wikimedia/qa-browsertests/blob/master/features/login.feature
Comment 21 Željko Filipin 2013-12-04 14:17:13 UTC
Created attachment 13979 [details]
e-mail notification with failed tests
Comment 22 Željko Filipin 2013-12-04 22:12:32 UTC
I forgot to say, now you can test e-mail notifications using your jobs. If you have any questions, let me know.
Comment 23 Željko Filipin 2013-12-05 15:15:08 UTC
Geoffrey,

see attached file on how an e-mail notification after failed test should look like. It is generated by this test:

https://geofbot.ci.cloudbees.com/job/test2/lastCompletedBuild/testReport/
Comment 24 Željko Filipin 2013-12-05 15:15:42 UTC
Created attachment 13990 [details]
how e-mail notification after failed test should look like
Comment 25 Geoffrey Mon 2013-12-06 01:07:35 UTC
(In reply to comment #24)
> Created attachment 13990 [details]
> how e-mail notification after failed test should look like

Do you want the entire table there in the email?  Right now I have the notifications working with everything and it looks pretty close to the jenkins build page.
Comment 26 Željko Filipin 2013-12-06 11:49:09 UTC
Geoffrey, the last e-mail that I got from your local Jenkins looked good to me! Please upload the template here so I can test it with our Jenkins and if it works I will close the task.

If you would like to continue working on the template (making it look more like Jenkins web page) I will create another task.

If you would like to work on something else, we have plenty of tasks.
Comment 27 Geoffrey Mon 2013-12-06 23:18:36 UTC
Created attachment 14019 [details]
Final email template (for now)
Comment 28 Geoffrey Mon 2013-12-06 23:19:27 UTC
(In reply to comment #26)
> If you would like to continue working on the template (making it look more
> like
> Jenkins web page) I will create another task.

Sure, I would definitely like to finish up this template.
Comment 29 Geoffrey Mon 2013-12-07 16:33:51 UTC
(In reply to comment #15)
> Created attachment 13967 [details]
> First version of jenkins template ready for testing
> 
> 1. To use this template, place it under $JENKINS_HOME/email-templates/
> 2. make sure email-ext plugin is installed
> 3. Under the job config for post-build actions, remove "email notification"
> and
> add "editable email notification"
> 4. Change default content type to html
> 5. Change body to ${SCRIPT, template="wikimedia-jenkins.template-1"}
> 6. Optional - change the subject using the token references; here is the one
> i
> used: ${PROJECT_NAME} ${BUILD_NUMBER} - ${BUILD_STATUS}
> 7. Set the recipients, etc.
> 8. Open Advanced Settings... and there you can change when an email
> notification is triggered.

If you want the subject to be constant for one build, make the subject just ${PROJECT_NAME}
Comment 30 Željko Filipin 2013-12-10 13:25:39 UTC
Asked cloudbees to upload the template:

https://cloudbees.zendesk.com/requests/14940
Comment 31 Željko Filipin 2013-12-10 14:22:33 UTC
As far as I am concerned, this bug is resolved. If you need more/less information in Jenkins e-mail notification, leave a comment. See attached e-mail for "before" and "after".
Comment 32 Željko Filipin 2013-12-10 14:22:59 UTC
Created attachment 14047 [details]
before
Comment 33 Željko Filipin 2013-12-10 14:23:21 UTC
Created attachment 14048 [details]
after
Comment 34 Gerrit Notification Bot 2013-12-21 18:24:10 UTC
Change 103114 had a related patch set uploaded by Sn1per:
Add jenkins email template for better email notifications

https://gerrit.wikimedia.org/r/103114
Comment 35 Gerrit Notification Bot 2013-12-23 15:29:40 UTC
Change 103114 merged by Cmcmahon:
Add jenkins email template for better email notifications

https://gerrit.wikimedia.org/r/103114
Comment 36 Gerrit Notification Bot 2014-01-09 16:57:32 UTC
Change 106513 had a related patch set uploaded by Zfilipin:
Use new e-mail template

https://gerrit.wikimedia.org/r/106513
Comment 37 Gerrit Notification Bot 2014-01-09 18:04:38 UTC
Change 106513 merged by Cmcmahon:
Use new e-mail template

https://gerrit.wikimedia.org/r/106513

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links