From 178a6a122946539298a6a064eaa26509eb6f8eac Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sun, 26 Sep 2010 16:53:10 +0200 Subject: mail author when build fail --- scripts/build-failed.sh | 11 +++++++++++ scripts/builder.pl | 19 +++++++++++++++---- scripts/builder.sh | 21 --------------------- 3 files changed, 26 insertions(+), 25 deletions(-) create mode 100644 scripts/build-failed.sh delete mode 100755 scripts/builder.sh (limited to 'scripts') diff --git a/scripts/build-failed.sh b/scripts/build-failed.sh new file mode 100644 index 0000000..bddf4d0 --- /dev/null +++ b/scripts/build-failed.sh @@ -0,0 +1,11 @@ +COMMITER=$1 +MESSAGE=$2 +OUTPUT=$3 +SHA=$4 + +echo " +Message: +$MESSAGE + +$OUTPUT +" | mail -s "[jitterbug] BUILD FAILED $SHA" --to $COMMITER diff --git a/scripts/builder.pl b/scripts/builder.pl index b7b37c0..ae32056 100644 --- a/scripts/builder.pl +++ b/scripts/builder.pl @@ -46,21 +46,32 @@ while (1) { project => $project, repo => $repo, commit => $commit, - status => 1, time => time(), %$desc, }; - my @versions = glob($report_path.'/*'); + my @versions = glob( $report_path . '/*' ); foreach my $version (@versions) { open my $fh, '<', $version; - my @lines = <$fh>; + my @lines = <$fh>; my $result = pop @lines; + while ( $result !~ /^Result/ ) { + $result = pop @lines; + } chomp $result; $result =~ s/Result:\s//; - my ($name, ) = basename($version); + my ( $name, ) = basename($version); $name =~ s/\.txt//; + if ( $result !~ /PASS/ ) { + # mail author of the commit + my $message = $desc->{message}; + my $commiter = $desc->{author}->{email}; + my $output = "Build failed"; + my $sha = $desc->{commit}; + `./scripts/build-failed $commiter $message $output $sha`; + } $build->{version}->{$name} = $result; + close $fh; } my $build_key = join( ':', 'jitterbug', 'build', $commit ); diff --git a/scripts/builder.sh b/scripts/builder.sh deleted file mode 100755 index 01eb92e..0000000 --- a/scripts/builder.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -e - -gitrepo=$1 -project=$2 -commit=$3 - -ORIGIN=$(pwd) -BUILDDIR=$(mktemp -d) -LOGDIR="/tmp/jitterbug" -mkdir -p $LOGDIR -logfile="$LOGDIR/$project.$commit.txt" -cd $BUILDDIR -rm -rf $project -git clone $gitrepo $project -cd $project -git checkout $commit -perl Makefile.PL -make -make test 2>&1 > $logfile -cd .. -rm -rf $BUILDDIR -- cgit 1.4.1