summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan "Duke" Leto <jonathan@leto.net>2011-04-21 12:48:31 -0400
committerJonathan "Duke" Leto <jonathan@leto.net>2011-04-21 12:48:31 -0400
commit2c43dc92b41977798f157a2e2809e55d2ef6ed33 (patch)
treeb13658f6c66fad055e8e1d642dca55b6a6653fa1
parentAdd a dep on DateTime::Format::SQLite (diff)
parentAllow the config file to specify per-project builder and builder_variables, w... (diff)
downloadjitterbug-2c43dc92b41977798f157a2e2809e55d2ef6ed33.tar.gz
Merge branch 'custom_build' into reuse_repo
Conflicts: lib/jitterbug/Builder.pm
-rw-r--r--MANIFEST15
-rw-r--r--lib/jitterbug/Builder.pm27
2 files changed, 32 insertions, 10 deletions
diff --git a/MANIFEST b/MANIFEST
index 0adea84..2a8967d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,6 +5,8 @@ environments/development.yml
environments/production.yml
jitterbug.pl
lib/jitterbug.pm
+lib/jitterbug/Builder.pm
+lib/jitterbug/Emailer.pm
lib/jitterbug/Hook.pm
lib/jitterbug/Plugin/Template.pm
lib/jitterbug/Project.pm
@@ -26,14 +28,23 @@ public/images/perldancer-bg.jpg
public/images/perldancer.jpg
README
scripts/builder.pl
-scripts/deploy_schema
-scripts/migrate_from_redis.pl
+sql/_source/deploy/1/001-auto-__VERSION.yml
+sql/_source/deploy/1/001-auto.yml
+sql/_source/deploy/2/001-auto-__VERSION.yml
+sql/_source/deploy/2/001-auto.yml
+sql/_source/deploy/3/001-auto-__VERSION.yml
+sql/_source/deploy/3/001-auto.yml
+sql/_source/deploy/4/001-auto-__VERSION.yml
+sql/_source/deploy/4/001-auto.yml
t/001_base.t
t/002_index_route.t
t/003_hook_route.t
t/004_project.t
+t/006_emailer.t
t/data/export_jitterbug.yml
t/data/test.yaml
+t/data/test.yml
+t/lib/jitterbug/Test.pm
TODO
views/index.tt
views/layouts/main.tt
diff --git a/lib/jitterbug/Builder.pm b/lib/jitterbug/Builder.pm
index 2af15d2..02c07bd 100644
--- a/lib/jitterbug/Builder.pm
+++ b/lib/jitterbug/Builder.pm
@@ -82,26 +82,34 @@ sub sleep {
}
sub run_task {
- my $self = shift;
- my ($task) = @_;
- my $desc = JSON::decode_json( $task->commit->content );
- my $conf = $self->{'conf'};
+ my ($self,$task) = @_;
+
+ my $desc = JSON::decode_json( $task->commit->content );
+ my $conf = $self->{'conf'};
my $buildconf = $conf->{'jitterbug'}{'build_process'};
+ my $project = $task->project;
my $dt = DateTime->now();
$task->update({started_when => $dt});
$desc->{'build'}{'start_time'} = $dt->epoch;
debug("Build Start");
+
my $report_path = dir(
$conf->{'jitterbug'}{'reports'}{'dir'},
- $task->project->name,
+ $project->name,
$task->commit->sha256,
);
my $dir = $conf->{'jitterbug'}{'build'}{'dir'};
mkdir $dir unless -d $dir;
- my $build_dir = dir($dir, $task->project->name);
+ my $build_dir = dir($dir, $project->name);
+
+ debug("Removing $build_dir");
+ rmtree($build_dir, { error => \my $err } );
+ warn @$err if @$err;
+
+ $self->sleep(1); # avoid race conditions
my $r;
my $repo = $task->project->url . '.git';
@@ -144,7 +152,8 @@ sub run_task {
system("git checkout " . $task->commit->sha256 );
chdir $pwd;
- my $builder = $conf->{'jitterbug'}{'build_process'}{'builder'};
+ my $builder = $conf->{'jitterbug'}{'projects'}{$project->name}{'builder'}
+ || $conf->{'jitterbug'}{'build_process'}{'builder'};
my $perlbrew = $conf->{'jitterbug'}{'options'}{'perlbrew'};
my $email_on_pass = $conf->{'jitterbug'}{'options'}{'email_on_pass'};
@@ -152,7 +161,9 @@ sub run_task {
debug("email_on_pass = $email_on_pass");
debug("perlbrew = $perlbrew");
- my $builder_variables = $conf->{'jitterbug'}{'build_process'}{'builder_variables'};
+ # If the project has custom builder variables, use those. Otherwise, use the global setting
+ my $builder_variables = $conf->{'jitterbug'}{'projects'}{$project->name}{'builder_variables'}
+ || $conf->{'jitterbug'}{'build_process'}{'builder_variables'};
my $builder_command = "$builder_variables $builder $build_dir $report_path $perlbrew";