Remove obsolete JobStatus source
This commit is contained in:
parent
c7a039bd05
commit
ed132cf1fc
|
@ -71,8 +71,6 @@ sub overview : Chained('job') PathPart('') Args(0) {
|
||||||
sub get_builds : Chained('job') PathPart('') CaptureArgs(0) {
|
sub get_builds : Chained('job') PathPart('') CaptureArgs(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
$c->stash->{allBuilds} = $c->stash->{job}->builds;
|
$c->stash->{allBuilds} = $c->stash->{job}->builds;
|
||||||
$c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatusForJob')
|
|
||||||
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]});
|
|
||||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJob')
|
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJob')
|
||||||
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]});
|
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]});
|
||||||
$c->stash->{channelBaseName} =
|
$c->stash->{channelBaseName} =
|
||||||
|
|
|
@ -183,8 +183,6 @@ sub jobs_tab : Chained('jobsetChain') PathPart('jobs-tab') Args(0) {
|
||||||
sub get_builds : Chained('jobsetChain') PathPart('') CaptureArgs(0) {
|
sub get_builds : Chained('jobsetChain') PathPart('') CaptureArgs(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
$c->stash->{allBuilds} = $c->stash->{jobset}->builds;
|
$c->stash->{allBuilds} = $c->stash->{jobset}->builds;
|
||||||
$c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatusForJobset')
|
|
||||||
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]});
|
|
||||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJobset')
|
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJobset')
|
||||||
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]});
|
->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]});
|
||||||
$c->stash->{channelBaseName} =
|
$c->stash->{channelBaseName} =
|
||||||
|
|
|
@ -202,8 +202,6 @@ sub updateProject {
|
||||||
sub get_builds : Chained('projectChain') PathPart('') CaptureArgs(0) {
|
sub get_builds : Chained('projectChain') PathPart('') CaptureArgs(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
$c->stash->{allBuilds} = $c->stash->{project}->builds;
|
$c->stash->{allBuilds} = $c->stash->{project}->builds;
|
||||||
$c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatusForProject')
|
|
||||||
->search({}, {bind => [$c->stash->{project}->name]});
|
|
||||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForProject')
|
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForProject')
|
||||||
->search({}, {bind => [$c->stash->{project}->name]});
|
->search({}, {bind => [$c->stash->{project}->name]});
|
||||||
$c->stash->{channelBaseName} = $c->stash->{project}->name;
|
$c->stash->{channelBaseName} = $c->stash->{project}->name;
|
||||||
|
|
|
@ -150,7 +150,6 @@ sub machines :Local Args(0) {
|
||||||
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
|
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
$c->stash->{allBuilds} = $c->model('DB::Builds');
|
$c->stash->{allBuilds} = $c->model('DB::Builds');
|
||||||
$c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatus');
|
|
||||||
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceeded');
|
$c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceeded');
|
||||||
$c->stash->{channelBaseName} = "everything";
|
$c->stash->{channelBaseName} = "everything";
|
||||||
$c->stash->{total} = $c->model('DB::NrBuilds')->find('finished')->count;
|
$c->stash->{total} = $c->model('DB::NrBuilds')->find('finished')->count;
|
||||||
|
|
|
@ -576,34 +576,6 @@ sub makeQueries {
|
||||||
|
|
||||||
my $activeJobs = "(select distinct project, jobset, job, system from Builds where isCurrent = 1 $constraint)";
|
my $activeJobs = "(select distinct project, jobset, job, system from Builds where isCurrent = 1 $constraint)";
|
||||||
|
|
||||||
makeSource(
|
|
||||||
"JobStatus$name",
|
|
||||||
# Urgh, can't use "*" in the "select" here because of the status change join.
|
|
||||||
<<QUERY
|
|
||||||
select x.*, b.id as statusChangeId, b.timestamp as statusChangeTime
|
|
||||||
from
|
|
||||||
(select
|
|
||||||
(select max(b.id) from Builds b
|
|
||||||
where
|
|
||||||
project = activeJobs.project and jobset = activeJobs.jobset
|
|
||||||
and job = activeJobs.job and system = activeJobs.system
|
|
||||||
and finished = 1
|
|
||||||
) as id
|
|
||||||
from $activeJobs as activeJobs
|
|
||||||
) as latest
|
|
||||||
join Builds x using (id)
|
|
||||||
left join Builds b on
|
|
||||||
b.id =
|
|
||||||
(select max(c.id) from Builds c
|
|
||||||
where
|
|
||||||
c.finished = 1 and
|
|
||||||
x.project = c.project and x.jobset = c.jobset and x.job = c.job and x.system = c.system and
|
|
||||||
x.id > c.id and
|
|
||||||
((x.buildStatus = 0 and c.buildStatus != 0) or
|
|
||||||
(x.buildStatus != 0 and c.buildStatus = 0)))
|
|
||||||
QUERY
|
|
||||||
);
|
|
||||||
|
|
||||||
makeSource(
|
makeSource(
|
||||||
"LatestSucceeded$name",
|
"LatestSucceeded$name",
|
||||||
<<QUERY
|
<<QUERY
|
||||||
|
|
|
@ -7,13 +7,13 @@ my $db = Hydra::Model::DB->new;
|
||||||
my @sources = $db->schema->sources;
|
my @sources = $db->schema->sources;
|
||||||
my $nrtables = scalar(@sources);
|
my $nrtables = scalar(@sources);
|
||||||
|
|
||||||
use Test::Simple tests => 42;
|
use Test::Simple tests => 38;
|
||||||
|
|
||||||
foreach my $source (@sources) {
|
foreach my $source (@sources) {
|
||||||
my $title = "Basic select query for $source";
|
my $title = "Basic select query for $source";
|
||||||
if ($source eq "SchemaVersion" || $source eq "NrBuilds") {
|
if ($source eq "SchemaVersion" || $source eq "NrBuilds") {
|
||||||
ok(scalar($db->resultset($source)->all) == 1, $title);
|
ok(scalar($db->resultset($source)->all) == 1, $title);
|
||||||
} elsif( $source !~ m/^(LatestSucceeded|JobStatus)/) {
|
} elsif( $source !~ m/^LatestSucceeded/) {
|
||||||
ok(scalar($db->resultset($source)->all) == 0, $title);
|
ok(scalar($db->resultset($source)->all) == 0, $title);
|
||||||
} else {
|
} else {
|
||||||
ok(scalar($db->resultset($source)->search({},{ bind => ["", "", ""] })) == 0, $title);
|
ok(scalar($db->resultset($source)->search({},{ bind => ["", "", ""] })) == 0, $title);
|
||||||
|
|
Loading…
Reference in a new issue