Add one-shot jobsets

There are jobsets that are evaluated only once, that is, after they've
been evaluated, they're disabled automatically.  This is primarily
useful for doing releases: for instance, doing an evaluation with
"officialRelease" set to "true" should be done only once.
This commit is contained in:
Eelco Dolstra
2013-10-11 12:01:52 +02:00
parent 0babdf3532
commit c4e39d4769
9 changed files with 36 additions and 19 deletions

View File

@ -31,11 +31,7 @@ sub overview : Chained('job') PathPart('') Args(0) {
$c->stash->{queuedBuilds} = [
$job->builds->search(
{ finished => 0 },
{ join => ['project']
, order_by => ["priority DESC", "id"]
, '+select' => ['project.enabled']
, '+as' => ['enabled']
}
{ order_by => ["priority DESC", "id"] }
) ];
# If this is an aggregate job, then get its constituents.

View File

@ -197,14 +197,15 @@ sub updateJobset {
my ($nixExprPath, $nixExprInput) = nixExprPathFromParams $c;
my $enabled = defined $c->stash->{params}->{enabled};
my $enabled = int($c->stash->{params}->{enabled});
die if $enabled < 0 || $enabled > 2;
$jobset->update(
{ name => $jobsetName
, description => trim($c->stash->{params}->{"description"})
, nixexprpath => $nixExprPath
, nixexprinput => $nixExprInput
, enabled => $enabled ? 1 : 0
, enabled => $enabled
, enableemail => defined $c->stash->{params}->{enableemail} ? 1 : 0
, emailoverride => trim($c->stash->{params}->{emailoverride}) || ""
, hidden => defined $c->stash->{params}->{visible} ? 0 : 1

View File

@ -74,7 +74,7 @@ sub queue_GET {
$self->status_ok(
$c,
entity => [$c->model('DB::Builds')->search(
{finished => 0}, { join => ['project'], order_by => ["priority DESC", "id"], columns => [@buildListColumns], '+select' => ['project.enabled'], '+as' => ['enabled'] })]
{finished => 0}, { order_by => ["priority DESC", "id"], columns => [@buildListColumns] })]
);
}