forked from lix-project/hydra
Merge pull request #1093 from DeterminateSystems/builds-jobset-project
Builds: drop the jobset and project columns
This commit is contained in:
commit
ed1b532b74
|
@ -200,7 +200,7 @@ sub machines :Local Args(0) {
|
|||
|
||||
$c->stash->{machines} = $machines;
|
||||
$c->stash->{steps} = dbh($c)->selectall_arrayref(
|
||||
"select build, stepnr, s.system as system, s.drvpath as drvpath, machine, s.starttime as starttime, jobsets.project, jobsets.name, job, s.busy as busy " .
|
||||
"select build, stepnr, s.system as system, s.drvpath as drvpath, machine, s.starttime as starttime, jobsets.project as project, jobsets.name as jobset, job, s.busy as busy " .
|
||||
"from BuildSteps s " .
|
||||
"join Builds b on s.build = b.id " .
|
||||
"join Jobsets jobsets on jobsets.id = b.jobset_id " .
|
||||
|
|
|
@ -120,8 +120,8 @@ sub buildFinished {
|
|||
|
||||
sendEmail(
|
||||
$self->{config}, $to, $subject, $body,
|
||||
[ 'X-Hydra-Project' => $topbuild->get_column('project'),
|
||||
, 'X-Hydra-Jobset' => $topbuild->get_column('jobset'),
|
||||
[ 'X-Hydra-Project' => $topbuild->jobset->get_column('project'),
|
||||
, 'X-Hydra-Jobset' => $topbuild->jobset->get_column('name'),
|
||||
, 'X-Hydra-Job' => $topbuild->get_column('job'),
|
||||
, 'X-Hydra-System' => $topbuild->system
|
||||
]);
|
||||
|
|
|
@ -59,7 +59,7 @@ sub buildFinished {
|
|||
|
||||
my $msg = "";
|
||||
$msg .= "<img src='$img'/> ";
|
||||
$msg .= "Job <a href='$baseurl/job/${\$topbuild->get_column('project')}/${\$topbuild->get_column('jobset')}/${\$topbuild->get_column('job')}'>${\showJobName($topbuild)}</a>";
|
||||
$msg .= "Job <a href='$baseurl/job/${\$topbuild->jobset->get_column('project')}/${\$topbuild->jobset->get_column('name')}/${\$topbuild->get_column('job')}'>${\showJobName($topbuild)}</a>";
|
||||
$msg .= " (and ${\scalar @deps} others)" if scalar @deps > 0;
|
||||
$msg .= ": <a href='$baseurl/build/${\$topbuild->id}'>" . showStatus($topbuild) . "</a>";
|
||||
|
||||
|
|
|
@ -111,9 +111,9 @@ sub buildFinished {
|
|||
my $tagSet = {
|
||||
status => toBuildStatusClass($b->buildstatus),
|
||||
result => toBuildStatusDetailed($b->buildstatus),
|
||||
project => $b->get_column('project'),
|
||||
jobset => $b->get_column('jobset'),
|
||||
repo => ($b->get_column('jobset') =~ /^(.*)\.pr-/) ? $1 : $b->get_column('jobset'),
|
||||
project => $b->jobset->get_column('project'),
|
||||
jobset => $b->jobset->get_column('name'),
|
||||
repo => ($b->jobset->get_column('name') =~ /^(.*)\.pr-/) ? $1 : $b->jobset->get_column('name'),
|
||||
job => $b->get_column('job'),
|
||||
system => $b->system,
|
||||
cached => $b->iscachedbuild ? "true" : "false",
|
||||
|
|
|
@ -140,7 +140,7 @@ sub buildFinished {
|
|||
"danger";
|
||||
|
||||
my $text = "";
|
||||
$text .= "Job <$baseurl/job/${\$topbuild->get_column('project')}/${\$topbuild->get_column('jobset')}/${\$topbuild->get_column('job')}|${\showJobName($topbuild)}>";
|
||||
$text .= "Job <$baseurl/job/${\$topbuild->jobset->get_column('project')}/${\$topbuild->jobset->get_column('name')}/${\$topbuild->get_column('job')}|${\showJobName($topbuild)}>";
|
||||
$text .= " (and ${\scalar @deps} others)" if scalar @deps > 0;
|
||||
$text .= ": <$baseurl/build/${\$topbuild->id}|" . showStatus($topbuild) . ">". " in " . renderDuration($topbuild);
|
||||
|
||||
|
|
|
@ -52,18 +52,6 @@ __PACKAGE__->table("builds");
|
|||
data_type: 'integer'
|
||||
is_nullable: 0
|
||||
|
||||
=head2 project
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 jobset
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 jobset_id
|
||||
|
||||
data_type: 'integer'
|
||||
|
@ -206,10 +194,6 @@ __PACKAGE__->add_columns(
|
|||
{ data_type => "integer", is_nullable => 0 },
|
||||
"timestamp",
|
||||
{ data_type => "integer", is_nullable => 0 },
|
||||
"project",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
"jobset",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
"jobset_id",
|
||||
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
|
||||
"job",
|
||||
|
@ -439,21 +423,6 @@ __PACKAGE__->belongs_to(
|
|||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
|
||||
);
|
||||
|
||||
=head2 jobset_project_jobset
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Result::Jobsets>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"jobset_project_jobset",
|
||||
"Hydra::Schema::Result::Jobsets",
|
||||
{ name => "jobset", project => "project" },
|
||||
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 jobsetevalinputs
|
||||
|
||||
Type: has_many
|
||||
|
@ -484,21 +453,6 @@ __PACKAGE__->has_many(
|
|||
undef,
|
||||
);
|
||||
|
||||
=head2 project
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Result::Projects>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"project",
|
||||
"Hydra::Schema::Result::Projects",
|
||||
{ name => "project" },
|
||||
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 runcommandlogs
|
||||
|
||||
Type: has_many
|
||||
|
@ -543,8 +497,8 @@ __PACKAGE__->many_to_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-17 12:42:34
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ylttv/NTMDcSZumBXRCOCw
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-10 09:43:38
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DQF8KRinnf0imJOP+lvH9Q
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"dependents",
|
||||
|
@ -643,4 +597,9 @@ sub as_json {
|
|||
return $json;
|
||||
}
|
||||
|
||||
sub project {
|
||||
my ($self) = @_;
|
||||
return $self->jobset->project;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -257,7 +257,7 @@ __PACKAGE__->has_many(
|
|||
undef,
|
||||
);
|
||||
|
||||
=head2 builds_jobset_ids
|
||||
=head2 builds
|
||||
|
||||
Type: has_many
|
||||
|
||||
|
@ -266,30 +266,12 @@ Related object: L<Hydra::Schema::Result::Builds>
|
|||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"builds_jobset_ids",
|
||||
"builds",
|
||||
"Hydra::Schema::Result::Builds",
|
||||
{ "foreign.jobset_id" => "self.id" },
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 builds_project_jobsets
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::Result::Builds>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"builds_project_jobsets",
|
||||
"Hydra::Schema::Result::Builds",
|
||||
{
|
||||
"foreign.jobset" => "self.name",
|
||||
"foreign.project" => "self.project",
|
||||
},
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobsetevals
|
||||
|
||||
Type: has_many
|
||||
|
@ -372,8 +354,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-26 12:02:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iI44C3BFTo6IsS1tBwWYsg
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-08 22:24:10
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cQOnMitrWGMoJX6kZGNW+w
|
||||
|
||||
use JSON::MaybeXS;
|
||||
|
||||
|
|
|
@ -142,21 +142,6 @@ __PACKAGE__->has_many(
|
|||
undef,
|
||||
);
|
||||
|
||||
=head2 builds
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::Result::Builds>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"builds",
|
||||
"Hydra::Schema::Result::Builds",
|
||||
{ "foreign.project" => "self.name" },
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobsetrenames
|
||||
|
||||
Type: has_many
|
||||
|
@ -243,8 +228,8 @@ Composing rels: L</projectmembers> -> username
|
|||
__PACKAGE__->many_to_many("usernames", "projectmembers", "username");
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-26 12:02:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nKVZ8ZNCZQQ52zbpDAaoQQ
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-08 22:24:10
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r/wbX3FAm5/OFrrwOQL5fA
|
||||
|
||||
use JSON::MaybeXS;
|
||||
|
||||
|
|
|
@ -476,8 +476,6 @@ sub checkBuild {
|
|||
# Add the build to the database.
|
||||
$build = $jobset->builds->create(
|
||||
{ timestamp => $time
|
||||
, project => $jobset->project
|
||||
, jobset => $jobset->name
|
||||
, jobset_id => $jobset->id
|
||||
, job => $jobName
|
||||
, description => null($buildInfo->{description})
|
||||
|
|
|
@ -162,8 +162,6 @@ create table Builds (
|
|||
timestamp integer not null, -- time this build was added
|
||||
|
||||
-- Info about the inputs.
|
||||
project text not null,
|
||||
jobset text not null,
|
||||
jobset_id integer not null,
|
||||
job text not null,
|
||||
|
||||
|
@ -224,9 +222,7 @@ create table Builds (
|
|||
check (finished = 0 or (stoptime is not null and stoptime != 0)),
|
||||
check (finished = 0 or (starttime is not null and starttime != 0)),
|
||||
|
||||
foreign key (jobset_id) references Jobsets(id) on delete cascade,
|
||||
foreign key (project) references Projects(name) on update cascade,
|
||||
foreign key (project, jobset) references Jobsets(project, name) on update cascade
|
||||
foreign key (jobset_id) references Jobsets(id) on delete cascade
|
||||
);
|
||||
|
||||
|
||||
|
@ -672,16 +668,11 @@ create index IndexBuildStepsOnStopTime on BuildSteps(stopTime desc) where startT
|
|||
create index IndexBuildStepOutputsOnPath on BuildStepOutputs(path);
|
||||
create index IndexBuildsOnFinished on Builds(finished) where finished = 0;
|
||||
create index IndexBuildsOnIsCurrent on Builds(isCurrent) where isCurrent = 1;
|
||||
create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent) where isCurrent = 1;
|
||||
create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent) where isCurrent = 1;
|
||||
create index IndexBuildsJobsetIdCurrentUnfinished on Builds(jobset_id) where isCurrent = 1 and finished = 0;
|
||||
create index IndexBuildsJobsetIdCurrentFinishedStatus on Builds(jobset_id, buildstatus) where isCurrent = 1 and finished = 1;
|
||||
create index IndexBuildsJobsetIdCurrent on Builds(jobset_id) where isCurrent = 1;
|
||||
create index IndexBuildsOnJobset on Builds(project, jobset);
|
||||
create index IndexBuildsOnProject on Builds(project);
|
||||
create index IndexBuildsOnTimestamp on Builds(timestamp);
|
||||
create index IndexBuildsOnFinishedStopTime on Builds(finished, stoptime DESC);
|
||||
create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC);
|
||||
create index IndexBuildsOnJobsetIdFinishedId on Builds(jobset_id, job, finished, id DESC);
|
||||
create index IndexFinishedSuccessfulBuilds on Builds(jobset_id, job, finished, buildstatus, id DESC) where buildstatus = 0 and finished = 1;
|
||||
create index IndexBuildsOnDrvPath on Builds(drvPath);
|
||||
|
|
9
src/sql/upgrade-80.sql
Normal file
9
src/sql/upgrade-80.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
drop index IndexBuildsOnJobsetIsCurrent;
|
||||
drop index IndexBuildsOnJobIsCurrent;
|
||||
drop index IndexBuildsOnJobset;
|
||||
drop index IndexBuildsOnProject;
|
||||
drop index IndexBuildsOnJobFinishedId;
|
||||
|
||||
alter table Builds
|
||||
drop column project,
|
||||
drop column jobset;
|
Loading…
Reference in a new issue