Skip to content
Browse files

Add on_failure_to_email and on_pass_to_email config keys

These keys can be used to override where pass/fail emails go. If they
are defined, emails are sent to the specified email. If not, they go
to the commit author.

This feature is sponsored by IRC insultbots and the letters B, A, C,
E and K.

No bits where harmed in the making of this feature.
  • Loading branch information...
1 parent 2c96015 commit 3527de189fc88d0fd3f2cfda153dc1d723dfa25a @leto leto committed Feb 23, 2011
Showing with 9 additions and 1 deletion.
  1. +2 −0 config.yml
  2. +3 −1 lib/jitterbug/Emailer.pm
  3. +2 −0 t/005_builder.t
  4. +2 −0 t/data/test.yml
View
2 config.yml
@@ -19,12 +19,14 @@ jitterbug:
builder: ./scripts/capsule.sh
builder_variables:
on_failure: ./scripts/build-failed.sh
+ on_failure_to_email:
on_failure_cc_email: alice@example.com
on_failure_from_email: donotreply@example.com
on_failure_subject_prefix: "[jitterbug] FAIL "
on_failure_header:
on_failure_footer:
on_pass: ./scripts/build-pass.sh
+ on_pass_to_email:
on_pass_cc_email: alice@example.com
on_pass_subject_prefix: "[jitterbug] PASS "
on_pass_from_email: donotreply@example.com
View
4 lib/jitterbug/Emailer.pm
@@ -42,7 +42,6 @@ sub run {
my $sha1 = $task->commit->sha256;
my $shortsha1 = substr($sha1, 0, 8);
my $desc = JSON::decode_json( $task->commit->content );
- my $email = $desc->{'author'}{'email'};
my $message = $desc->{'message'};
my $header = $buildconf->{"on_${status}_header"};
my $footer = $buildconf->{"on_${status}_footer"};
@@ -60,6 +59,9 @@ sub run {
my ($short_message) = split /\n/, $message;
+ # Default to the to_email specified in our config. If it isn't set,
+ # use the author email
+ my $email = $buildconf->{"on_${status}_to_email"} || $desc->{'author'}{'email'};
my $stuff = Email::Stuff->from($buildconf->{"on_${status}_from_email"})
# bug in Email::Stuff brakes chaining if $email is empty
View
2 t/005_builder.t
@@ -64,10 +64,12 @@ jitterbug::Test->init();
'on_pass_header' => undef,
'on_failure_subject_prefix' => '[jitterbug] FAIL ',
'on_failure_from_email' => 'donotreply@example.com',
+ 'on_failure_to_email' => 'bob@example.com',
'on_failure_footer' => undef,
'on_failure_header' => undef,
'on_pass_footer' => undef,
'on_pass_cc_email' => 'alice@example.com',
+ 'on_pass_to_email' => undef,
'on_pass_from_email' => 'donotreply@example.com',
'on_failure_cc_email' => 'alice@example.com',
'on_pass' => './scripts/build-pass.sh',
View
2 t/data/test.yml
@@ -19,12 +19,14 @@ jitterbug:
builder: ./scripts/capsule.sh
builder_variables: STUFF=BLAH
on_failure: ./scripts/build-failed.sh
+ on_failure_to_email: bob@example.com
on_failure_cc_email: alice@example.com
on_failure_from_email: donotreply@example.com
on_failure_subject_prefix: "[jitterbug] FAIL "
on_failure_header:
on_failure_footer:
on_pass: ./scripts/build-pass.sh
+ on_pass_to_email:
on_pass_cc_email: alice@example.com
on_pass_subject_prefix: "[jitterbug] PASS "
on_pass_from_email: donotreply@example.com

0 comments on commit 3527de1

Please sign in to comment.
Something went wrong with that request. Please try again.