diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/builder.pl | 34 | ||||
-rwxr-xr-x | scripts/capsule.sh | 3 |
2 files changed, 22 insertions, 15 deletions
diff --git a/scripts/builder.pl b/scripts/builder.pl index ae32056..e8fa87d 100644 --- a/scripts/builder.pl +++ b/scripts/builder.pl @@ -13,18 +13,18 @@ use Git::Repository; $|++; -my $conf = LoadFile('config.yml'); -my $redis = Redis->new(server => $conf->{redis}); -my $key = join(':', 'jitterbug', 'tasks'); +my $conf = LoadFile('config.yml'); +my $redis = Redis->new( server => $conf->{redis} ); +my $key = join( ':', 'jitterbug', 'tasks' ); while (1) { my $task_key = $redis->spop($key); if ($task_key) { - my $task = $redis->get($task_key); - my $desc = JSON::decode_json($task); - my $repo = $desc->{repo} . '.git'; - my $commit = delete $desc->{id}; - my $project = delete $desc->{project}; + my $task = $redis->get($task_key); + my $desc = JSON::decode_json($task); + my $repo = $desc->{repo} . '.git'; + my $commit = delete $desc->{id}; + my $project = delete $desc->{project}; my $report_path = File::Spec->catdir( $conf->{jitterbug}->{reports}->{dir}, @@ -34,19 +34,20 @@ while (1) { File::Spec->catdir( $conf->{jitterbug}->{build}->{dir}, $project ); my $r = Git::Repository->create( clone => $repo => $build_dir ); - $r->run('checkout', $commit); + $r->run( 'checkout', $commit ); - my $res = `./scripts/capsule.sh $build_dir $report_path`; + my $builder = $conf->{jitterbug}->{build_process}->{builder}; + my $res = `$builder $build_dir $report_path`; rmtree($build_dir); $redis->del($task_key); my $build = { - project => $project, - repo => $repo, - commit => $commit, - time => time(), + project => $project, + repo => $repo, + commit => $commit, + time => time(), %$desc, }; @@ -63,12 +64,15 @@ while (1) { 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`; + my $on_failure = + $conf->{jitterbug}->{build_process}->{on_failure}; + `$on_failure $commiter $message $output $sha`; } $build->{version}->{$name} = $result; close $fh; diff --git a/scripts/capsule.sh b/scripts/capsule.sh index 0535529..a5fc076 100755 --- a/scripts/capsule.sh +++ b/scripts/capsule.sh @@ -1,5 +1,8 @@ #!/bin/bash +# first arg: build_dir +# second arg: report path + set -e builddir=$1 |