* added support for twitter notification

[?]
Oct 15, 2009, 1:23 PM
CXRCPDSQEWHSZNCJIORUAINH5I2FFFQ7AVUQOB62REGROLROPE7QC

Dependencies

  • [2] QUTWJR7P * Include more info in notification emails.
  • [*] SAFVRDTK * Put Hydra's dependencies so that they can easily be installed in a
  • [*] 7YBYT2LQ
  • [*] RWIBJ5L4 * Autoflush stdout.
  • [*] 3BKF6P72 * Use Nix's negative caching.
  • [*] OG7BEM57
  • [*] KA45EBF5 * Send email if a build fails.

Change contents

  • edit in deps.nix at line 21
    [2.25]
    [4.497]
    perlPackages.NetTwitterLite
  • edit in src/script/hydra_build.pl at line 16
    [2.69]
    [6.0]
    use Net::Twitter::Lite;
  • edit in src/script/hydra_build.pl at line 32
    [7.153]
    [8.400]
    sub sendTwitterNotification {
    my ($build) = @_;
    return unless (defined $ENV{'TWITTER_USER'} && defined $ENV{'TWITTER_PASS'});
    my $addURL = defined $ENV{'HYDRA_BUILD_BASEURL'};
    my $jobName = $build->project->name . ":" . $build->jobset->name . ":" . $build->job->name;
    my $status = $build->resultInfo->buildstatus == 0 ? "SUCCEEDED" : "FAILED";
    my $system = $build->system;
    my $duration = ($build->resultInfo->stoptime - $build->resultInfo->starttime) . " seconds";
    my $url = $ENV{'HYDRA_BUILD_BASEURL'}."/".$build->id ;
  • edit in src/script/hydra_build.pl at line 46
    [8.401]
    [8.401]
    my $nt = Net::Twitter::Lite->new(
    username => $ENV{'TWITTER_USER'},
    password => $ENV{'TWITTER_PASS'}
    );
  • edit in src/script/hydra_build.pl at line 51
    [8.402]
    [8.402]
    my $tag = $build->project->name;
    my $msg = "$jobName ($system): $status in $duration #$tag";
    if (length($msg) + 1 + length($url) <= 140) {
    $msg = "$msg $url" ;
    }
    eval {
    my $result = eval { $nt->update($msg) };
    };
    warn "$@\n" if $@;
    }
  • edit in src/script/hydra_build.pl at line 407
    [9.1403]
    [5.6647]
    sendTwitterNotification $build;
  • edit in src/script/hydra_build.pl at line 416
    [9.1503]
    [9.1503]
    exit 0;
    }
    if ($ENV{'HYDRA_TWITTER_TEST'}) {
    sendTwitterNotification $db->resultset('Builds')->find($buildId);