Remove the Jobs table
This table has been superfluous for a long time.
This commit is contained in:
@ -86,7 +86,7 @@ sub build_GET {
|
||||
$c->stash->{prevBuilds} = [$c->model('DB::Builds')->search(
|
||||
{ project => $c->stash->{project}->name
|
||||
, jobset => $c->stash->{jobset}->name
|
||||
, job => $c->stash->{job}->name
|
||||
, job => $c->stash->{job}
|
||||
, 'me.system' => $build->system
|
||||
, finished => 1
|
||||
, buildstatus => 0
|
||||
|
@ -24,18 +24,16 @@ sub job : Chained('/') PathPart('job') CaptureArgs(3) {
|
||||
$c->detach;
|
||||
}
|
||||
|
||||
$c->stash->{job} = $c->stash->{jobset}->jobs->find({ name => $jobName })
|
||||
or notFound($c, "Job $projectName:$jobsetName:$jobName doesn't exist.");
|
||||
$c->stash->{project} = $c->stash->{job}->project;
|
||||
$c->stash->{job} = $jobName;
|
||||
$c->stash->{project} = $c->stash->{jobset}->project;
|
||||
}
|
||||
|
||||
sub prometheus : Chained('job') PathPart('prometheus') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my $job = $c->stash->{job};
|
||||
my $prometheus = Net::Prometheus->new;
|
||||
|
||||
my $lastBuild = $job->builds->find(
|
||||
{ finished => 1 },
|
||||
my $lastBuild = $c->stash->{jobset}->builds->find(
|
||||
{ job => $c->stash->{job}, finished => 1 },
|
||||
{ order_by => 'id DESC', rows => 1, columns => [@buildListColumns] }
|
||||
);
|
||||
|
||||
@ -46,7 +44,7 @@ sub prometheus : Chained('job') PathPart('prometheus') Args(0) {
|
||||
)->labels(
|
||||
$c->stash->{project}->name,
|
||||
$c->stash->{jobset}->name,
|
||||
$c->stash->{job}->name,
|
||||
$c->stash->{job},
|
||||
)->inc($lastBuild->stoptime);
|
||||
|
||||
$prometheus->new_gauge(
|
||||
@ -56,7 +54,7 @@ sub prometheus : Chained('job') PathPart('prometheus') Args(0) {
|
||||
)->labels(
|
||||
$c->stash->{project}->name,
|
||||
$c->stash->{jobset}->name,
|
||||
$c->stash->{job}->name,
|
||||
$c->stash->{job},
|
||||
)->inc($lastBuild->buildstatus > 0);
|
||||
|
||||
$c->stash->{'plain'} = { data => $prometheus->render };
|
||||
@ -65,23 +63,22 @@ sub prometheus : Chained('job') PathPart('prometheus') Args(0) {
|
||||
|
||||
sub overview : Chained('job') PathPart('') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my $job = $c->stash->{job};
|
||||
|
||||
$c->stash->{template} = 'job.tt';
|
||||
|
||||
$c->stash->{lastBuilds} =
|
||||
[ $job->builds->search({ finished => 1 },
|
||||
[ $c->stash->{jobset}->builds->search({ job => $c->stash->{job}, finished => 1 },
|
||||
{ order_by => 'id DESC', rows => 10, columns => [@buildListColumns] }) ];
|
||||
|
||||
$c->stash->{queuedBuilds} = [
|
||||
$job->builds->search(
|
||||
{ finished => 0 },
|
||||
$c->stash->{jobset}->builds->search(
|
||||
{ job => $c->stash->{job}, finished => 0 },
|
||||
{ order_by => ["priority DESC", "id"] }
|
||||
) ];
|
||||
|
||||
# If this is an aggregate job, then get its constituents.
|
||||
my @constituents = $c->model('DB::Builds')->search(
|
||||
{ aggregate => { -in => $job->builds->search({}, { columns => ["id"], order_by => "id desc", rows => 15 })->as_query } },
|
||||
{ aggregate => { -in => $c->stash->{jobset}->builds->search({ job => $c->stash->{job} }, { columns => ["id"], order_by => "id desc", rows => 15 })->as_query } },
|
||||
{ join => 'aggregateconstituents_constituents',
|
||||
columns => ['id', 'job', 'finished', 'buildstatus'],
|
||||
+select => ['aggregateconstituents_constituents.aggregate'],
|
||||
@ -91,10 +88,9 @@ sub overview : Chained('job') PathPart('') Args(0) {
|
||||
my $aggregates = {};
|
||||
my %constituentJobs;
|
||||
foreach my $b (@constituents) {
|
||||
my $jobName = $b->get_column('job');
|
||||
$aggregates->{$b->get_column('aggregate')}->{constituents}->{$jobName} =
|
||||
$aggregates->{$b->get_column('aggregate')}->{constituents}->{$b->job} =
|
||||
{ id => $b->id, finished => $b->finished, buildstatus => $b->buildstatus };
|
||||
$constituentJobs{$jobName} = 1;
|
||||
$constituentJobs{$b->job} = 1;
|
||||
}
|
||||
|
||||
foreach my $agg (keys %$aggregates) {
|
||||
@ -109,24 +105,23 @@ sub overview : Chained('job') PathPart('') Args(0) {
|
||||
$c->stash->{starred} = $c->user->starredjobs(
|
||||
{ project => $c->stash->{project}->name
|
||||
, jobset => $c->stash->{jobset}->name
|
||||
, job => $c->stash->{job}->name
|
||||
, job => $c->stash->{job}
|
||||
})->count == 1 if $c->user_exists;
|
||||
}
|
||||
|
||||
|
||||
sub metrics_tab : Chained('job') PathPart('metrics-tab') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my $job = $c->stash->{job};
|
||||
$c->stash->{template} = 'job-metrics-tab.tt';
|
||||
$c->stash->{metrics} = [ $job->buildmetrics->search(
|
||||
{ }, { select => ["name"], distinct => 1, order_by => "name", }) ];
|
||||
$c->stash->{metrics} = [ $c->stash->{jobset}->buildmetrics->search(
|
||||
{ job => $c->stash->{job} }, { select => ["name"], distinct => 1, order_by => "name", }) ];
|
||||
}
|
||||
|
||||
|
||||
sub build_times : Chained('job') PathPart('build-times') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my @res = $c->stash->{job}->builds->search(
|
||||
{ finished => 1, buildstatus => 0, closuresize => { '!=', 0 } },
|
||||
my @res = $c->stash->{jobset}->builds->search(
|
||||
{ job => $c->stash->{job}, finished => 1, buildstatus => 0, closuresize => { '!=', 0 } },
|
||||
{ join => "actualBuildStep"
|
||||
, "+select" => ["actualBuildStep.stoptime - actualBuildStep.starttime"]
|
||||
, "+as" => ["actualBuildTime"],
|
||||
@ -137,8 +132,8 @@ sub build_times : Chained('job') PathPart('build-times') Args(0) {
|
||||
|
||||
sub closure_sizes : Chained('job') PathPart('closure-sizes') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my @res = $c->stash->{job}->builds->search(
|
||||
{ finished => 1, buildstatus => 0, closuresize => { '!=', 0 } },
|
||||
my @res = $c->stash->{jobset}->builds->search(
|
||||
{ job => $c->stash->{job}, finished => 1, buildstatus => 0, closuresize => { '!=', 0 } },
|
||||
{ order_by => "id", columns => [ "id", "timestamp", "closuresize" ] });
|
||||
$self->status_ok($c, entity => [ map { { id => $_->id, timestamp => $_ ->timestamp, value => $_->closuresize } } @res ]);
|
||||
}
|
||||
@ -146,8 +141,8 @@ sub closure_sizes : Chained('job') PathPart('closure-sizes') Args(0) {
|
||||
|
||||
sub output_sizes : Chained('job') PathPart('output-sizes') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my @res = $c->stash->{job}->builds->search(
|
||||
{ finished => 1, buildstatus => 0, size => { '!=', 0 } },
|
||||
my @res = $c->stash->{jobset}->builds->search(
|
||||
{ job => $c->stash->{job}, finished => 1, buildstatus => 0, size => { '!=', 0 } },
|
||||
{ order_by => "id", columns => [ "id", "timestamp", "size" ] });
|
||||
$self->status_ok($c, entity => [ map { { id => $_->id, timestamp => $_ ->timestamp, value => $_->size } } @res ]);
|
||||
}
|
||||
@ -159,8 +154,8 @@ sub metric : Chained('job') PathPart('metric') Args(1) {
|
||||
$c->stash->{template} = 'metric.tt';
|
||||
$c->stash->{metricName} = $metricName;
|
||||
|
||||
my @res = $c->stash->{job}->buildmetrics->search(
|
||||
{ name => $metricName },
|
||||
my @res = $c->stash->{jobset}->buildmetrics->search(
|
||||
{ job => $c->stash->{job}, name => $metricName },
|
||||
{ order_by => "timestamp", columns => [ "build", "name", "timestamp", "value", "unit" ] });
|
||||
|
||||
$self->status_ok($c, entity => [ map { { id => $_->get_column("build"), timestamp => $_ ->timestamp, value => $_->value, unit => $_->unit } } @res ]);
|
||||
@ -170,11 +165,11 @@ sub metric : Chained('job') PathPart('metric') Args(1) {
|
||||
# Hydra::Base::Controller::ListBuilds needs this.
|
||||
sub get_builds : Chained('job') PathPart('') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{allBuilds} = $c->stash->{job}->builds;
|
||||
$c->stash->{allBuilds} = $c->stash->{jobset}->builds->search({ job => $c->stash->{job} });
|
||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJob')
|
||||
->search({}, {bind => [$c->stash->{jobset}->id, $c->stash->{job}->name]});
|
||||
->search({}, {bind => [$c->stash->{jobset}->id, $c->stash->{job}]});
|
||||
$c->stash->{channelBaseName} =
|
||||
$c->stash->{project}->name . "-" . $c->stash->{jobset}->name . "-" . $c->stash->{job}->name;
|
||||
$c->stash->{project}->name . "-" . $c->stash->{jobset}->name . "-" . $c->stash->{job};
|
||||
}
|
||||
|
||||
|
||||
@ -185,7 +180,7 @@ sub star : Chained('job') PathPart('star') Args(0) {
|
||||
my $args =
|
||||
{ project => $c->stash->{project}->name
|
||||
, jobset => $c->stash->{jobset}->name
|
||||
, job => $c->stash->{job}->name
|
||||
, job => $c->stash->{job}
|
||||
};
|
||||
if ($c->request->params->{star} eq "1") {
|
||||
$c->user->starredjobs->update_or_create($args);
|
||||
|
@ -459,16 +459,16 @@ sub search :Local Args(0) {
|
||||
},
|
||||
{ order_by => ["project", "name"], join => ["project"] } ) ];
|
||||
|
||||
$c->stash->{jobs} = [ $c->model('DB::Jobs')->search(
|
||||
{ "me.name" => { ilike => "%$query%" }
|
||||
$c->stash->{jobs} = [ $c->model('DB::Builds')->search(
|
||||
{ "job" => { ilike => "%$query%" }
|
||||
, "project.hidden" => 0
|
||||
, "jobset.hidden" => 0
|
||||
, iscurrent => 1
|
||||
},
|
||||
{ order_by => ["enabled_ desc", "project", "jobset", "name"], join => ["project", "jobset"]
|
||||
, "+select" => [\ "(project.enabled = 1 and jobset.enabled = 1 and exists (select 1 from Builds where project = project.name and jobset = jobset.name and job = me.name and iscurrent = 1)) as enabled_"]
|
||||
, "+as" => ["enabled"]
|
||||
{ order_by => ["project", "jobset", "job"], join => ["project", "jobset"]
|
||||
, rows => $c->stash->{limit} + 1
|
||||
} ) ];
|
||||
} )
|
||||
];
|
||||
|
||||
# Perform build search in separate queries to prevent seq scan on buildoutputs table.
|
||||
$c->stash->{builds} = [ $c->model('DB::Builds')->search(
|
||||
|
@ -339,10 +339,10 @@ sub dashboard :Chained('dashboard_base') :PathPart('') :Args(0) {
|
||||
# Get the N most recent builds for each starred job.
|
||||
$c->stash->{starredJobs} = [];
|
||||
foreach my $j ($c->stash->{user}->starredjobs->search({}, { order_by => ['project', 'jobset', 'job'] })) {
|
||||
my @builds = $j->job->builds->search(
|
||||
{ },
|
||||
my @builds = $j->jobset->builds->search(
|
||||
{ job => $j->job },
|
||||
{ rows => 20, order_by => "id desc" });
|
||||
push @{$c->stash->{starredJobs}}, { job => $j->job, builds => [@builds] };
|
||||
push @{$c->stash->{starredJobs}}, { job => $j, builds => [@builds] };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ sub getBuild {
|
||||
sub getPreviousBuild {
|
||||
my ($build) = @_;
|
||||
return undef if !defined $build;
|
||||
return $build->job->builds->search(
|
||||
return $build->jobset->builds->search(
|
||||
{ finished => 1
|
||||
, system => $build->system
|
||||
, 'me.id' => { '<' => $build->id }
|
||||
|
@ -71,7 +71,6 @@ __PACKAGE__->table("buildmetrics");
|
||||
=head2 job
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 timestamp
|
||||
@ -95,7 +94,7 @@ __PACKAGE__->add_columns(
|
||||
"jobset",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
"job",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"timestamp",
|
||||
{ data_type => "integer", is_nullable => 0 },
|
||||
);
|
||||
@ -131,21 +130,6 @@ __PACKAGE__->belongs_to(
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
|
||||
);
|
||||
|
||||
=head2 job
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Jobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"job",
|
||||
"Hydra::Schema::Jobs",
|
||||
{ jobset => "jobset", name => "job", project => "project" },
|
||||
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 jobset
|
||||
|
||||
Type: belongs_to
|
||||
@ -177,8 +161,8 @@ __PACKAGE__->belongs_to(
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Roy7h/K9u7DQOzet4B1sbA
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-27 17:40:41
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AYUVs6RdefFKw+g9Yxcu/A
|
||||
|
||||
sub json_hint {
|
||||
return { columns => ['value', 'unit'] };
|
||||
|
@ -73,7 +73,6 @@ __PACKAGE__->table("builds");
|
||||
=head2 job
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 nixname
|
||||
@ -224,7 +223,7 @@ __PACKAGE__->add_columns(
|
||||
"jobset_id",
|
||||
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
|
||||
"job",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"nixname",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"description",
|
||||
@ -439,21 +438,6 @@ __PACKAGE__->has_many(
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 job
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Jobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"job",
|
||||
"Hydra::Schema::Jobs",
|
||||
{ jobset => "jobset", name => "job", project => "project" },
|
||||
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 jobset
|
||||
|
||||
Type: belongs_to
|
||||
@ -558,8 +542,8 @@ __PACKAGE__->many_to_many(
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-06 12:32:57
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3IyFj/9Zf/hvmhBY4U/IBQ
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-27 17:40:41
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RIKKFfcKXFWIUeM8ma++iw
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"dependents",
|
||||
|
@ -1,216 +0,0 @@
|
||||
use utf8;
|
||||
package Hydra::Schema::Jobs;
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader
|
||||
# DO NOT MODIFY THE FIRST PART OF THIS FILE
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Hydra::Schema::Jobs
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'DBIx::Class::Core';
|
||||
|
||||
=head1 COMPONENTS LOADED
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L<Hydra::Component::ToJSON>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->load_components("+Hydra::Component::ToJSON");
|
||||
|
||||
=head1 TABLE: C<jobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->table("jobs");
|
||||
|
||||
=head1 ACCESSORS
|
||||
|
||||
=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'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 name
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
"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 },
|
||||
"name",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
);
|
||||
|
||||
=head1 PRIMARY KEY
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L</project>
|
||||
|
||||
=item * L</jobset>
|
||||
|
||||
=item * L</name>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->set_primary_key("project", "jobset", "name");
|
||||
|
||||
=head1 RELATIONS
|
||||
|
||||
=head2 buildmetrics
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::BuildMetrics>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"buildmetrics",
|
||||
"Hydra::Schema::BuildMetrics",
|
||||
{
|
||||
"foreign.job" => "self.name",
|
||||
"foreign.jobset" => "self.jobset",
|
||||
"foreign.project" => "self.project",
|
||||
},
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 builds
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::Builds>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"builds",
|
||||
"Hydra::Schema::Builds",
|
||||
{
|
||||
"foreign.job" => "self.name",
|
||||
"foreign.jobset" => "self.jobset",
|
||||
"foreign.project" => "self.project",
|
||||
},
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobset
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Jobsets>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"jobset",
|
||||
"Hydra::Schema::Jobsets",
|
||||
{ id => "jobset_id" },
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
|
||||
);
|
||||
|
||||
=head2 jobset_project_jobset
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Jobsets>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"jobset_project_jobset",
|
||||
"Hydra::Schema::Jobsets",
|
||||
{ name => "jobset", project => "project" },
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 project
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Projects>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"project",
|
||||
"Hydra::Schema::Projects",
|
||||
{ name => "project" },
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 starredjobs
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::StarredJobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"starredjobs",
|
||||
"Hydra::Schema::StarredJobs",
|
||||
{
|
||||
"foreign.job" => "self.name",
|
||||
"foreign.jobset" => "self.jobset",
|
||||
"foreign.project" => "self.project",
|
||||
},
|
||||
undef,
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:33:28
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:C5Tyh8Ke4yC6q7KIFVOHcQ
|
||||
|
||||
=head2 builds
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Sc2hema::Builds>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"builds",
|
||||
"Hydra::Schema::Builds",
|
||||
{
|
||||
"foreign.job" => "self.name",
|
||||
"foreign.jobset_id" => "self.jobset_id",
|
||||
},
|
||||
undef,
|
||||
);
|
||||
|
||||
1;
|
@ -201,8 +201,8 @@ __PACKAGE__->belongs_to(
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:21:11
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ar6GRni8AcAQmuZyg6tFKw
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-27 17:40:41
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:M61ikfnjORU7jDAH8P/j7w
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"buildIds",
|
||||
|
@ -290,39 +290,6 @@ __PACKAGE__->has_many(
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobs_jobset_ids
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::Jobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"jobs_jobset_ids",
|
||||
"Hydra::Schema::Jobs",
|
||||
{ "foreign.jobset_id" => "self.id" },
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobs_project_jobsets
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::Jobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"jobs_project_jobsets",
|
||||
"Hydra::Schema::Jobs",
|
||||
{
|
||||
"foreign.jobset" => "self.name",
|
||||
"foreign.project" => "self.project",
|
||||
},
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobsetevals
|
||||
|
||||
Type: has_many
|
||||
@ -408,8 +375,8 @@ __PACKAGE__->has_many(
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:32:17
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:P8+t7rgpOqkGwRdM2b+3Bw
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-27 17:40:41
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aDW78MCelU/ma953aTcHvA
|
||||
|
||||
|
||||
=head2 builds
|
||||
|
@ -157,21 +157,6 @@ __PACKAGE__->has_many(
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobs
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::Jobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"jobs",
|
||||
"Hydra::Schema::Jobs",
|
||||
{ "foreign.project" => "self.name" },
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 jobsetevals
|
||||
|
||||
Type: has_many
|
||||
@ -273,8 +258,8 @@ Composing rels: L</projectmembers> -> username
|
||||
__PACKAGE__->many_to_many("usernames", "projectmembers", "username");
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-06 12:32:57
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dEIVgrFGilPfITprs6nYuA
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-27 17:40:41
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iBGJjFWiI9Wy9zwT7xGOEA
|
||||
|
||||
my %hint = (
|
||||
columns => [
|
||||
|
@ -56,7 +56,6 @@ __PACKAGE__->table("starredjobs");
|
||||
=head2 job
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=cut
|
||||
@ -69,7 +68,7 @@ __PACKAGE__->add_columns(
|
||||
"jobset",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
"job",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
);
|
||||
|
||||
=head1 PRIMARY KEY
|
||||
@ -92,21 +91,6 @@ __PACKAGE__->set_primary_key("username", "project", "jobset", "job");
|
||||
|
||||
=head1 RELATIONS
|
||||
|
||||
=head2 job
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Jobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"job",
|
||||
"Hydra::Schema::Jobs",
|
||||
{ jobset => "jobset", name => "job", project => "project" },
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 jobset
|
||||
|
||||
Type: belongs_to
|
||||
@ -153,8 +137,8 @@ __PACKAGE__->belongs_to(
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fw4FfzmOhzDk0ZoSuNr2ww
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-27 17:36:07
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RRDQ6UQL/bjXPD+HO1s5ug
|
||||
|
||||
|
||||
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
||||
|
@ -37,12 +37,8 @@ sub stripSSHUser {
|
||||
# Check whether the given job is a member of the most recent jobset
|
||||
# evaluation.
|
||||
sub jobExists {
|
||||
my ($self, $c, $job) = @_;
|
||||
my $latestEval = $job->jobset->jobsetevals->search(
|
||||
{ hasnewbuilds => 1},
|
||||
{ rows => 1, order_by => ["id desc"] })->single;
|
||||
return 0 if !defined $latestEval; # can't happen
|
||||
return scalar($latestEval->builds->search({ job => $job->name })) != 0;
|
||||
my ($self, $c, $jobset, $jobName) = @_;
|
||||
return defined $jobset->builds->search({ job => $jobName, iscurrent => 1 })->single;
|
||||
}
|
||||
|
||||
1;
|
||||
|
Reference in New Issue
Block a user