forked from lix-project/hydra
Allow comparing an evaluation with an arbitrary other evaluation
The URI parameter "compare=..." can denote either an arbitrary evaluation ID, or the name of a jobset in the same project. In the latter case, the comparison is made against the latest completed evaluation of the specified jobset.
This commit is contained in:
parent
2f9153c640
commit
69e600da89
|
@ -351,9 +351,9 @@ sub evals : Chained('jobset') PathPart('evals') Args(0) {
|
||||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1))"
|
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1))"
|
||||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))"
|
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))"
|
||||||
]
|
]
|
||||||
, '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ]
|
, '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ]
|
||||||
, rows => $resultsPerPage
|
, rows => $resultsPerPage + 1
|
||||||
, page => $page
|
, offset => ($page - 1) * $resultsPerPage
|
||||||
}
|
}
|
||||||
) ];
|
) ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,35 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
||||||
|
|
||||||
my $eval = $c->stash->{eval};
|
my $eval = $c->stash->{eval};
|
||||||
|
|
||||||
my ($eval2) = $eval->jobset->jobsetevals->search(
|
my $compare = $c->req->params->{compare};
|
||||||
{ hasnewbuilds => 1, id => { '<', $eval->id } },
|
my $eval2;
|
||||||
{ order_by => "id DESC", rows => 1 });
|
|
||||||
|
|
||||||
|
# Allow comparing this evaluation against the previous evaluation
|
||||||
|
# (default), an arbitrary evaluation, or the latest completed
|
||||||
|
# evaluation of another jobset.
|
||||||
|
if (defined $compare && $compare =~ /^\d+$/) {
|
||||||
|
$eval2 = $c->model('DB::JobsetEvals')->find($compare)
|
||||||
|
or notFound($c, "Evaluation $compare doesn't exist.");
|
||||||
|
} elsif (defined $compare && $compare =~ /^($jobNameRE)$/) {
|
||||||
|
my $j = $c->stash->{project}->jobsets->find({name => $compare})
|
||||||
|
or notFound($c, "Jobset $compare doesn't exist.");
|
||||||
|
($eval2) = $j->jobsetevals->search(
|
||||||
|
{ hasnewbuilds => 1 },
|
||||||
|
{ order_by => "id DESC", rows => 1
|
||||||
|
, where => \ "not exists (select 1 from JobsetEvalMembers m join Builds b on m.build = b.id where m.eval = me.id and b.finished = 0)"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
($eval2) = $eval->jobset->jobsetevals->search(
|
||||||
|
{ hasnewbuilds => 1, id => { '<', $eval->id } },
|
||||||
|
{ order_by => "id DESC", rows => 1 });
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash->{otherEval} = $eval2 if defined $eval2;
|
||||||
|
|
||||||
my @builds = $eval->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] });
|
my @builds = $eval->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] });
|
||||||
my @builds2 = $eval2->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] });
|
my @builds2 = defined $eval2
|
||||||
|
? $eval2->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] })
|
||||||
|
: ();
|
||||||
|
|
||||||
$c->stash->{stillSucceed} = [];
|
$c->stash->{stillSucceed} = [];
|
||||||
$c->stash->{stillFail} = [];
|
$c->stash->{stillFail} = [];
|
||||||
|
@ -44,12 +67,15 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
||||||
my $n = 0;
|
my $n = 0;
|
||||||
foreach my $build (@builds) {
|
foreach my $build (@builds) {
|
||||||
my $d;
|
my $d;
|
||||||
|
my $found = 0;
|
||||||
while ($n < scalar(@builds2)) {
|
while ($n < scalar(@builds2)) {
|
||||||
my $build2 = $builds2[$n];
|
my $build2 = $builds2[$n];
|
||||||
my $d = $build->get_column('job') cmp $build2->get_column('job')
|
my $d = $build->get_column('job') cmp $build2->get_column('job')
|
||||||
|| $build->get_column('system') cmp $build2->get_column('system');
|
|| $build->get_column('system') cmp $build2->get_column('system');
|
||||||
|
last if $d == -1;
|
||||||
if ($d == 0) {
|
if ($d == 0) {
|
||||||
$n++;
|
$n++;
|
||||||
|
$found = 1;
|
||||||
if ($build->finished == 0 || $build2->finished == 0) {
|
if ($build->finished == 0 || $build2->finished == 0) {
|
||||||
push @{$c->stash->{unfinished}}, $build;
|
push @{$c->stash->{unfinished}}, $build;
|
||||||
} elsif ($build->buildstatus == 0 && $build2->buildstatus == 0) {
|
} elsif ($build->buildstatus == 0 && $build2->buildstatus == 0) {
|
||||||
|
@ -62,13 +88,11 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
||||||
push @{$c->stash->{nowFail}}, $build;
|
push @{$c->stash->{nowFail}}, $build;
|
||||||
} else { die; }
|
} else { die; }
|
||||||
last;
|
last;
|
||||||
} elsif ($d == -1) {
|
|
||||||
push @{$c->stash->{new}}, $build;
|
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
push @{$c->stash->{removed}}, { job => $build2->get_column('job'), system => $build2->get_column('system') };
|
push @{$c->stash->{removed}}, { job => $build2->get_column('job'), system => $build2->get_column('system') };
|
||||||
$n++;
|
$n++;
|
||||||
}
|
}
|
||||||
|
push @{$c->stash->{new}}, $build if !$found;
|
||||||
}
|
}
|
||||||
|
|
||||||
$c->stash->{full} = ($c->req->params->{full} || "0") eq "1";
|
$c->stash->{full} = ($c->req->params->{full} || "0") eq "1";
|
||||||
|
|
|
@ -38,10 +38,8 @@
|
||||||
|
|
||||||
|
|
||||||
[%- BLOCK renderFullJobsetName -%]
|
[%- BLOCK renderFullJobsetName -%]
|
||||||
<tt>
|
<tt>[% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %]</tt>
|
||||||
[% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %]
|
[%- END -%]
|
||||||
</tt>
|
|
||||||
[% END %]
|
|
||||||
|
|
||||||
|
|
||||||
[%- BLOCK renderFullJobName -%]
|
[%- BLOCK renderFullJobName -%]
|
||||||
|
|
|
@ -3,7 +3,13 @@
|
||||||
|
|
||||||
<h1>Jobset <tt>[% project.name %]:[% jobset.name %]</tt> evaluation [% eval.id %]</h1>
|
<h1>Jobset <tt>[% project.name %]:[% jobset.name %]</tt> evaluation [% eval.id %]</h1>
|
||||||
|
|
||||||
<!-- <p>Info on evaluation [% eval.id %]...<p> -->
|
[%- IF otherEval -%]
|
||||||
|
<p>Comparisons are relative to [% INCLUDE renderFullJobsetName
|
||||||
|
project=otherEval.jobset.project.name jobset=otherEval.jobset.name %]
|
||||||
|
evaluation <a href="[%
|
||||||
|
c.uri_for(c.controller('JobsetEval').action_for('view'),
|
||||||
|
[otherEval.id]) %]">[% otherEval.id %]</a>.</p>
|
||||||
|
[%- END -%]
|
||||||
|
|
||||||
[%- BLOCK renderSome -%]
|
[%- BLOCK renderSome -%]
|
||||||
[% size = builds.size; max = full ? size : 30; %]
|
[% size = builds.size; max = full ? size : 30; %]
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
<h1>Evaluations of Jobset <tt>[% INCLUDE renderLink
|
<h1>Evaluations of Jobset <tt>[% INCLUDE renderLink
|
||||||
uri = c.uri_for(c.controller('Project').action_for('view'), [project.name])
|
uri = c.uri_for(c.controller('Project').action_for('view'), [project.name])
|
||||||
title = project.name %]:[% jobset.name %]</tt></h1>
|
title = project.name %]:[% jobset.name %]</tt></h1>
|
||||||
|
|
||||||
|
[% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %]
|
||||||
|
|
||||||
<p>Showing evaluations [% (page - 1) * resultsPerPage + 1 %] - [%
|
<p>Showing evaluations [% (page - 1) * resultsPerPage + 1 %] - [%
|
||||||
(page - 1) * resultsPerPage + evals.size %] out of [% total %].</p>
|
(page - 1) * resultsPerPage + nrShown %] out of [% total %].</p>
|
||||||
|
|
||||||
[% INCLUDE renderPager %]
|
[% INCLUDE renderPager %]
|
||||||
|
|
||||||
|
@ -19,7 +21,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
[% last = evals.size - 2; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %]
|
[% last = nrShown - 1; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %]
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="[% c.uri_for(c.controller('JobsetEval').action_for('view'), [eval.id]) %]">[% eval.id %]</a> </td>
|
<td><a href="[% c.uri_for(c.controller('JobsetEval').action_for('view'), [eval.id]) %]">[% eval.id %]</a> </td>
|
||||||
<td>[% INCLUDE renderDateTime timestamp = eval.timestamp %] </td>
|
<td>[% INCLUDE renderDateTime timestamp = eval.timestamp %] </td>
|
||||||
|
|
Loading…
Reference in a new issue