Jenkins can now send email

Hi all,

In response to a good idea from Lzap about failed plugin builds being
able to email authors, I've enabled SMTP on Jenkins. This is configured
via the Email-Ext plugin [1].

The global config (SMTP auth is done) but for defaults, no triggers are
currently enabled, so that no-one suddenly gets spammed by this. Each
project needs its own config, added as a post-build action. Here's an
example I added ro deploy_web to test:

Add post-build action: Editable Email Notification
Add my email to Project Recipient List
Click Advanced settings
Add "Always" trigger
Set Send To to "Recipient List"

I then rebuilt deploy_web and got the email below :slight_smile:

However, because this is job config, we'll need to add it to JJB to
stop it being overwritten. Does anyone have a moment to look into
adding it to the JJB files? Then adding authors to plugins for
notifications can be a simple PR.

Enjoy!
Greg

··· -------- Forwarded Message -------- From: jenkins@theforeman.org Reply-to: noreply-ci@theforeman.org To: Subject: deploy_web - Build # 1315 - Successful! Date: Thu, 26 Oct 2017 09:46:08 +0000 (UTC)

deploy_web - Build # 1315 - Successful:

Check console output at http://ci.theforeman.org/job/deploy_web/1315/
to view the results.

Apparently Jenkins could send email before, but I was unaware of it, so
sorry if I confused anyone there. In any case, the sending is a little
clearer now as a result of my changes (hat tip to Eric for the info).

Apparently users should also be able to create their own email
notifications. From the tooltip on the config page:

"Enabling watching allows individual users to add their own triggers to
jobs. The list of triggers they can add is restricted by the trigger
implementer. For example, most script based triggers are not allowed
for users to use as a watch. Users must have READ access to the job in
order to watch it.

Triggers are not stored in the job itself, but as a property on the
user."

I have enabled it, but I can't just see where to add this to my user.
Perhaps someone with better eyes can spot it. If it works it will
remove the need to update JJB so frequently (only for the permenent,
important notifications).

Greg

As is always the case, I found it right after hitting send :wink:

So, there will be some JJB config - the job does need an "Editable
Email Notification" post-build action adding. However, unless required,
you can delete all the triggers - simply having the action there is
enough.

Once that's done, the main page of the job has a "Watch Job" link which
you can use to add a notify for yourself of results from that job.

One thing I'm seeing is that notifications appear to be in some way
shared across jobs - adding "On failure" to job1, and then "On
success"£ to job2, I see "On success" on job1. If that's more than just
a visual bug, this may not be usable - in which case we can fall back
on JJB config anyway. Test and feedback please :slight_smile:

Greg

··· On Thu, 2017-10-26 at 12:58 +0100, Greg Sutcliffe wrote: > I have enabled it, but I can't just see where to add this to my user. > Perhaps someone with better eyes can spot it. If it works it will > remove the need to update JJB so frequently (only for the permenent, > important notifications).

Greg, thanks for doing this. Now, honestly I do not understand a
single paragraph here.

Can you show me an example JJB patch how to enable this for a plugin?
Ideally discovery, with my spam eating lzap+rpm@redhat.com :slight_smile:

LZ

··· On Thu, Oct 26, 2017 at 2:21 PM, Greg Sutcliffe wrote: > On Thu, 2017-10-26 at 12:58 +0100, Greg Sutcliffe wrote: >> I have enabled it, but I can't just see where to add this to my user. >> Perhaps someone with better eyes can spot it. If it works it will >> remove the need to update JJB so frequently (only for the permenent, >> important notifications). > > As is always the case, I found it right after hitting send ;) > > So, there will be some JJB config - the job does need an "Editable > Email Notification" post-build action adding. However, unless required, > you can delete all the triggers - simply having the action there is > enough. > > Once that's done, the main page of the job has a "Watch Job" link which > you can use to add a notify for yourself of results from that job. > > One thing I'm seeing is that notifications appear to be in some way > shared across jobs - adding "On failure" to job1, and then "On > success"£ to job2, I see "On success" on job1. If that's more than just > a visual bug, this may not be usable - in which case we can fall back > on JJB config anyway. Test and feedback please :) > > Greg > > -- > You received this message because you are subscribed to the Google Groups "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.


Later,
Lukas @lzap Zapletal

I haven't looked at what's needed in JJB yet, so this is all temporary
at the moment. I made the needed change on the discovery job[1] (that
is, add post-build action with no triggers), so if you go there now,
you should see a Watch Job link. Try it out, let me know if it works.

[1] http://ci.theforeman.org/job/test_plugin_foreman_discovery_develop/

Greg

··· On Thu, 2017-10-26 at 14:50 +0200, Lukas Zapletal wrote: > Greg, thanks for doing this. Now, honestly I do not understand a > single paragraph here. > > Can you show me an example JJB patch how to enable this for a plugin? > Ideally discovery, with my spam eating lzap+rpm@redhat.com :-)

Ok added me into the list in the post-build action.

LZ

··· On Thu, Oct 26, 2017 at 2:58 PM, Greg Sutcliffe wrote: > On Thu, 2017-10-26 at 14:50 +0200, Lukas Zapletal wrote: >> Greg, thanks for doing this. Now, honestly I do not understand a >> single paragraph here. >> >> Can you show me an example JJB patch how to enable this for a plugin? >> Ideally discovery, with my spam eating lzap+rpm@redhat.com :-) > > I haven't looked at what's needed in JJB yet, so this is all temporary > at the moment. I made the needed change on the discovery job[1] (that > is, add post-build action with no triggers), so if you go there now, > you should see a Watch Job link. Try it out, let me know if it works. > > [1] http://ci.theforeman.org/job/test_plugin_foreman_discovery_develop/ > > Greg > > -- > You received this message because you are subscribed to the Google Groups "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.


Later,
Lukas @lzap Zapletal

Cool, trigger a build and see if you get an email :stuck_out_tongue:

Greg

··· On Thu, 2017-10-26 at 15:53 +0200, Lukas Zapletal wrote: > Ok added me into the list in the post-build action.

Ok waiting for:
https://github.com/theforeman/foreman_discovery/commit/473f28621aeba96bea53117611312a78b9159341

··· On Thu, Oct 26, 2017 at 5:08 PM, Greg Sutcliffe wrote: > On Thu, 2017-10-26 at 15:53 +0200, Lukas Zapletal wrote: >> Ok added me into the list in the post-build action. > > Cool, trigger a build and see if you get an email :P > > Greg > > -- > You received this message because you are subscribed to the Google Groups "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.


Later,
Lukas @lzap Zapletal