forked from lix-project/hydra
This commit is contained in:
parent
4044e857b6
commit
7c616aaf1a
|
@ -92,17 +92,25 @@ sub queue :Local {
|
|||
|
||||
# Return the latest build for each job.
|
||||
sub getLatestBuilds {
|
||||
my ($c, $builds) = @_;
|
||||
return $builds->search({},
|
||||
{ join => 'resultInfo'
|
||||
, where => {
|
||||
finished => { "!=", 0 },
|
||||
timestamp => \ (
|
||||
"= (select max(timestamp) from Builds " .
|
||||
"where project == me.project and attrName == me.attrName and finished != 0 and system == me.system)"),
|
||||
my ($c, $builds, $extraAttrs) = @_;
|
||||
|
||||
my @res = ();
|
||||
|
||||
foreach my $job ($builds->search({},
|
||||
{group_by => ['project', 'attrname', 'system']}))
|
||||
{
|
||||
my $attrs =
|
||||
{ project => $job->get_column('project')
|
||||
, attrname => $job->attrname
|
||||
, system => $job->system
|
||||
, finished => 1
|
||||
};
|
||||
my ($build) = $builds->search({ %$attrs, %$extraAttrs },
|
||||
{ join => 'resultInfo', order_by => 'timestamp DESC', rows => 1 } );
|
||||
push @res, $build if defined $build;
|
||||
}
|
||||
, order_by => "project, attrname, system"
|
||||
});
|
||||
|
||||
return [@res];
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,7 +119,7 @@ sub showJobStatus {
|
|||
$c->stash->{template} = 'jobstatus.tt';
|
||||
|
||||
# Get the latest finished build for each unique job.
|
||||
$c->stash->{latestBuilds} = [getLatestBuilds($c, $builds)];
|
||||
$c->stash->{latestBuilds} = getLatestBuilds($c, $builds, {});
|
||||
}
|
||||
|
||||
|
||||
|
@ -534,14 +542,14 @@ sub nix : Chained('/') PathPart('channel/latest') CaptureArgs(0) {
|
|||
|
||||
$c->stash->{channelName} = "hydra-all-latest";
|
||||
|
||||
my @builds = getLatestBuilds($c, $c->model('DB::Builds')); # !!! this includes failed builds
|
||||
my @builds = @{getLatestBuilds($c, $c->model('DB::Builds'), {buildStatus => 0})};
|
||||
|
||||
my @storePaths = ();
|
||||
foreach my $build (@builds) {
|
||||
# !!! better do this in getLatestBuilds with a join.
|
||||
next unless $build->buildproducts->find({type => "nix-build"});
|
||||
push @storePaths, $build->outpath if isValidPath($build->outpath);
|
||||
|
||||
next unless isValidPath($build->outpath);
|
||||
push @storePaths, $build->outpath;
|
||||
my $pkgName = $build->nixname . "-" . $build->system . "-" . $build->id . ".nixpkg";
|
||||
$c->stash->{nixPkgs}->{$pkgName} = $build;
|
||||
};
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
[% IF showSchedulingInfo %]
|
||||
<td>[% build.schedulingInfo.priority %]</td>
|
||||
[% END %]
|
||||
<td><a href="[% c.uri_for('/project' build.project.name) %]"><tt>[% build.project.name %]</tt></a></td>
|
||||
<td><a href="[% c.uri_for('/job' build.project.name build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
|
||||
<td><a href="[% c.uri_for('/project' build.get_column("project")) %]"><tt>[% build.get_column("project") %]</tt></a></td>
|
||||
<td><a href="[% c.uri_for('/job' build.get_column("project") build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
|
||||
<td>[% build.resultInfo.releasename ? build.resultInfo.releasename : build.nixname %]</td>
|
||||
<td><tt>[% build.system %]</tt></td>
|
||||
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
|
||||
|
|
Loading…
Reference in a new issue