hydra: make nr of build to keep configurable per jobset

This commit is contained in:
Rob Vermaas 2010-08-10 06:48:45 +00:00
parent 34e309f0f7
commit 9d9bf8b264
6 changed files with 29 additions and 41 deletions

View file

@ -231,6 +231,7 @@ sub updateJobset {
, enabled => trim($c->request->params->{enabled}) eq "1" ? 1 : 0
, enableemail => trim($c->request->params->{enableemail}) eq "1" ? 1 : 0
, emailoverride => trim($c->request->params->{emailoverride})
, keepnr => trim($c->request->params->{keepnr})
});
my %inputNames;

View file

@ -40,20 +40,6 @@ __PACKAGE__->table("CachedGitInputs");
is_nullable: 0
size: undef
=head2 timestamp
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 lastseen
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 sha256hash
data_type: text
@ -92,20 +78,6 @@ __PACKAGE__->add_columns(
is_nullable => 0,
size => undef,
},
"timestamp",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
"lastseen",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
"sha256hash",
{
data_type => "text",
@ -124,7 +96,7 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("uri", "branch", "revision");
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CoeyzZHUEPo7/VpIpLD+Pw
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-08-10 08:24:15
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4eYbLtiy5X3yegndBRFtSg
1;

View file

@ -106,6 +106,13 @@ __PACKAGE__->table("Jobsets");
is_nullable: 0
size: undef
=head2 keepnr
data_type: integer
default_value: 3
is_nullable: 0
size: undef
=cut
__PACKAGE__->add_columns(
@ -181,6 +188,8 @@ __PACKAGE__->add_columns(
is_nullable => 0,
size => undef,
},
"keepnr",
{ data_type => "integer", default_value => 3, is_nullable => 0, size => undef },
);
__PACKAGE__->set_primary_key("project", "name");
@ -280,7 +289,7 @@ __PACKAGE__->has_many(
);
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-06-04 16:32:43
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aQ+7TLIXnNDjjulPNqLq7A
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-08-10 08:24:15
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:b/GSJQxUcjCP4fn3peJVMg
1;

View file

@ -194,6 +194,12 @@
<td>
[% INCLUDE maybeEditString param="emailoverride" value=jobset.emailoverride %]
</td>
</tr>
<tr>
<th>Number of builds to keep:</th>
<td>
[% INCLUDE maybeEditString param="keepnr" value=jobset.keepnr %]
</td>
</tr>
[% IF !edit %]
<tr>

View file

@ -47,7 +47,7 @@ foreach my $project ($db->resultset('Projects')->search({hidden => 0},{})) {
# !!! Take time into account? E.g. don't delete builds that
# are younger than N days.
my @systems = $job->builds->search({ }, { select => ["system"], distinct => 1 })->all;
my $keepnr = $job->jobset->keepnr ;
foreach my $system (@systems) {
my @recentBuilds = $job->builds->search(
{ finished => 1
@ -56,7 +56,7 @@ foreach my $project ($db->resultset('Projects')->search({hidden => 0},{})) {
},
{ join => 'resultInfo'
, order_by => 'id DESC'
, rows => 3 # !!! should make this configurable
, rows => $keepnr
});
keepBuild $_ foreach @recentBuilds;
}

View file

@ -51,6 +51,7 @@ create table Jobsets (
enableEmail integer not null default 1,
hidden integer not null default 0,
emailOverride text not null,
keepnr integer not null default 3,
primary key (project, name),
foreign key (project) references Projects(name) on delete cascade on update cascade
#ifdef SQLITE
@ -504,7 +505,6 @@ create index IndexBuildsOnTimestamp on Builds(timestamp);
create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC);
create index IndexCachedHgInputsOnHash on CachedHgInputs(uri, branch, sha256hash);
create index IndexCachedGitInputsOnHash on CachedGitInputs(uri, branch, sha256hash);
create index IndexCachedGitInputsOnLastSeen on CachedGitInputs(uri, branch, lastSeen);
create index IndexCachedSubversionInputsOnUriRevision on CachedSubversionInputs(uri, revision);
create index IndexJobsetEvalMembersOnBuild on JobsetEvalMembers(build);
create index IndexJobsetInputAltsOnInput on JobsetInputAlts(project, jobset, input);