* Send email if a build fails.

[?]
Jul 8, 2009, 3:52 PM
KA45EBF5GVBBFQ2E6GSMDJ5ORSOJ7YP5EHAHLUZB226F7WNO6KYQC

Dependencies

  • [2] OG7BEM57
  • [3] AFTXA575 * $HYDRA_DATA environment variable.
  • [4] CLJQCY2X * Store info about all the build actions and allow them to be
  • [5] TULPZ62Y * Perform builds in parallel.
  • [6] 7YBYT2LQ
  • [7] 3BKF6P72 * Use Nix's negative caching.
  • [8] L2E6EVE2 * Merged the Build and Job tables.
  • [9] FHF6IZJQ * Basic release management: releases are now dynamically computed as
  • [*] RWIBJ5L4 * Autoflush stdout.

Change contents

  • edit in src/script/hydra_build.pl at line 12
    [2.399]
    [11.0]
    use Sys::Hostname::Long;
  • edit in src/script/hydra_build.pl at line 29
    [2.452]
    [2.452]
    die unless defined $build->resultInfo;
    return if !$build->maintainers;
    # Do we want to send mail?
  • replacement in src/script/hydra_build.pl at line 36
    [2.453][2.453:503]()
    print $build, " ", $build->maintainers, "\n";
    [2.453]
    [3.3075]
    if ($build->resultInfo->buildstatus == 0) {
    # Build succeeded. Only send mail if the previous build for
    # the same platform failed.
    return; # TODO
    }
    # Send mail.
    # !!! should use the Template Toolkit here.
    print STDERR "sending mail notification to ", $build->maintainers, "\n";
    my $jobName = $build->project->name . ":" . $build->jobset->name . ":" . $build->job->name;
    my $status =
    $build->resultInfo->buildstatus == 0 ? "SUCCEEDED" : "FAILED";
    my $sender = ($ENV{'USER'} || "hydra") . "@" . hostname_long . "\n";
  • replacement in src/script/hydra_build.pl at line 55
    [3.3076][2.504:540]()
    return if !$build->maintainers;
    [3.3076]
    [3.3076]
    my $selfURI = $ENV{'HYDRA_BASE_URI'} || "http://localhost:3000/";
    my $body = "Hi,\n"
    . "\n"
    . "This is to let you know that Hydra build " . $build->id
    . " of job " . $jobName . " has $status.\n"
    . "\n"
    . "The build information page can be found here: "
    . "$selfURI/build/" . $build->id . "\n"
    . "\n"
    . "Regards,\n\nThe Hydra build daemon.\n";
  • replacement in src/script/hydra_build.pl at line 70
    [2.644][2.644:760]()
    From => "Hydra <e.dolstra\@tudelft.nl>",
    Subject => "Build " . $build->id . " finished",
    [2.644]
    [2.760]
    From => "Hydra Build Daemon <$sender>",
    Subject => "Hydra job $jobName build " . $build->id . " $status",
  • replacement in src/script/hydra_build.pl at line 73
    [2.771][2.771:808]()
    body => "Build finished!\n",
    [2.771]
    [2.808]
    body => $body,
  • replacement in src/script/hydra_build.pl at line 76
    [2.816][2.816:845]()
    print $email->as_string;
    [2.816]
    [2.845]
    print $email->as_string if $ENV{'HYDRA_MAIL_TEST'};
  • replacement in src/script/hydra_build.pl at line 320
    [2.874][2.874:909]()
    #sendEmailNotification $build;
    [2.874]
    [3.6647]
    sendEmailNotification $build;
  • replacement in src/script/hydra_build.pl at line 327
    [3.6712][2.910:984]()
    #sendEmailNotification $db->resultset('Builds')->find($buildId);
    #exit 0;
    [3.6712]
    [2.984]
    if ($ENV{'HYDRA_MAIL_TEST'}) {
    sendEmailNotification $db->resultset('Builds')->find($buildId);
    exit 0;
    }