* Allow users to change the value of a build's "keep" flag, which

prevents the build output from being garbage collected.
This commit is contained in:
Eelco Dolstra
2009-03-14 23:56:57 +00:00
parent eeddf5752d
commit 32f0665d2c
3 changed files with 60 additions and 19 deletions

View File

@ -214,9 +214,7 @@ sub cancel : Chained('build') PathPart Args(0) {
# builds as well, but we would have to send a signal or
# something to the build process.
$build->finished(1);
$build->timestamp(time());
$build->update;
$build->update({finished => 1, timestamp => time});
$c->model('DB::BuildResultInfo')->create(
{ id => $build->id
@ -233,4 +231,24 @@ sub cancel : Chained('build') PathPart Args(0) {
}
sub keep : Chained('build') PathPart Args(1) {
my ($self, $c, $newStatus) = @_;
my $build = $c->stash->{build};
requireProjectOwner($c, $build->project);
die unless $newStatus == 0 || $newStatus == 1;
$c->model('DB')->schema->txn_do(sub {
$build->resultInfo->update({keep => int $newStatus});
});
$c->flash->{buildMsg} =
$newStatus == 0 ? "Build will not be kept." : "Build will be kept.";
$c->res->redirect($c->uri_for($self->action_for("view_build"), $c->req->captures));
}
1;