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
|
@ -352,8 +352,8 @@ 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 and b.buildStatus = 0))"
|
||||
]
|
||||
, '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ]
|
||||
, rows => $resultsPerPage
|
||||
, page => $page
|
||||
, rows => $resultsPerPage + 1
|
||||
, offset => ($page - 1) * $resultsPerPage
|
||||
}
|
||||
) ];
|
||||
}
|
||||
|
|
|
@ -26,12 +26,35 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
|||
|
||||
my $eval = $c->stash->{eval};
|
||||
|
||||
my ($eval2) = $eval->jobset->jobsetevals->search(
|
||||
my $compare = $c->req->params->{compare};
|
||||
my $eval2;
|
||||
|
||||
# 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 @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->{stillFail} = [];
|
||||
|
@ -44,12 +67,15 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
|||
my $n = 0;
|
||||
foreach my $build (@builds) {
|
||||
my $d;
|
||||
my $found = 0;
|
||||
while ($n < scalar(@builds2)) {
|
||||
my $build2 = $builds2[$n];
|
||||
my $d = $build->get_column('job') cmp $build2->get_column('job')
|
||||
|| $build->get_column('system') cmp $build2->get_column('system');
|
||||
last if $d == -1;
|
||||
if ($d == 0) {
|
||||
$n++;
|
||||
$found = 1;
|
||||
if ($build->finished == 0 || $build2->finished == 0) {
|
||||
push @{$c->stash->{unfinished}}, $build;
|
||||
} elsif ($build->buildstatus == 0 && $build2->buildstatus == 0) {
|
||||
|
@ -62,13 +88,11 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
|||
push @{$c->stash->{nowFail}}, $build;
|
||||
} else { die; }
|
||||
last;
|
||||
} elsif ($d == -1) {
|
||||
push @{$c->stash->{new}}, $build;
|
||||
last;
|
||||
}
|
||||
push @{$c->stash->{removed}}, { job => $build2->get_column('job'), system => $build2->get_column('system') };
|
||||
$n++;
|
||||
}
|
||||
push @{$c->stash->{new}}, $build if !$found;
|
||||
}
|
||||
|
||||
$c->stash->{full} = ($c->req->params->{full} || "0") eq "1";
|
||||
|
|
|
@ -38,10 +38,8 @@
|
|||
|
||||
|
||||
[%- BLOCK renderFullJobsetName -%]
|
||||
<tt>
|
||||
[% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %]
|
||||
</tt>
|
||||
[% END %]
|
||||
<tt>[% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %]</tt>
|
||||
[%- END -%]
|
||||
|
||||
|
||||
[%- BLOCK renderFullJobName -%]
|
||||
|
|
|
@ -3,7 +3,13 @@
|
|||
|
||||
<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 -%]
|
||||
[% size = builds.size; max = full ? size : 30; %]
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
uri = c.uri_for(c.controller('Project').action_for('view'), [project.name])
|
||||
title = project.name %]:[% jobset.name %]</tt></h1>
|
||||
|
||||
[% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %]
|
||||
|
||||
<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 %]
|
||||
|
||||
|
@ -19,7 +21,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<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>
|
||||
<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>
|
||||
|
|
Loading…
Reference in a new issue