diff --git a/src/lib/Hydra/Base/Controller/ListBuilds.pm b/src/lib/Hydra/Base/Controller/ListBuilds.pm index 73fc9c6a..fe2a9770 100644 --- a/src/lib/Hydra/Base/Controller/ListBuilds.pm +++ b/src/lib/Hydra/Base/Controller/ListBuilds.pm @@ -66,7 +66,7 @@ sub all : Chained('get_builds') PathPart { $c->stash->{builds} = [ $c->stash->{allBuilds}->search( { finished => 1 }, - { order_by => "timestamp DESC" + { order_by => "stoptime DESC" , columns => [@buildListColumns] , rows => $resultsPerPage , page => $page }) ]; @@ -97,7 +97,7 @@ sub latest : Chained('get_builds') PathPart('latest') { my ($self, $c, @rest) = @_; my ($latest) = $c->stash->{allBuilds}->search( - {finished => 1, buildstatus => 0}, {order_by => ["isCurrent DESC", "timestamp DESC"]}); + {finished => 1, buildstatus => 0}, {order_by => ["id DESC"]}); notFound($c, "There is no successful build to redirect to.") unless defined $latest; @@ -112,7 +112,7 @@ sub latest_for : Chained('get_builds') PathPart('latest-for') { notFound($c, "You need to specify a platform type in the URL.") unless defined $system; my ($latest) = $c->stash->{allBuilds}->search( - {finished => 1, buildstatus => 0, system => $system}, {order_by => ["isCurrent DESC", "timestamp DESC"]}); + {finished => 1, buildstatus => 0, system => $system}, {order_by => ["id DESC"]}); notFound($c, "There is no successful build for platform `$system' to redirect to.") unless defined $latest; diff --git a/src/lib/Hydra/Controller/API.pm b/src/lib/Hydra/Controller/API.pm index 36168fd2..04a6e54b 100644 --- a/src/lib/Hydra/Controller/API.pm +++ b/src/lib/Hydra/Controller/API.pm @@ -90,7 +90,7 @@ sub latestbuilds : Chained('api') PathPart('latestbuilds') Args(0) { $filter->{job} = $job if !$job eq ""; $filter->{system} = $system if !$system eq ""; - my @latest = $c->model('DB::Builds')->search($filter, {rows => $nr, order_by => ["timestamp DESC"] }); + my @latest = $c->model('DB::Builds')->search($filter, {rows => $nr, order_by => ["id DESC"] }); my @list; push @list, buildToHash($_) foreach @latest; @@ -142,7 +142,7 @@ sub queue : Chained('api') PathPart('queue') Args(0) { my $nr = $c->request->params->{nr}; error($c, "Parameter not defined!") if !defined $nr; - my @builds = $c->model('DB::Builds')->search({finished => 0}, {rows => $nr, order_by => ["busy DESC", "priority DESC", "timestamp"]}); + my @builds = $c->model('DB::Builds')->search({finished => 0}, {rows => $nr, order_by => ["busy DESC", "priority DESC", "id"]}); my @list; push @list, buildToHash($_) foreach @builds; diff --git a/src/lib/Hydra/Controller/Admin.pm b/src/lib/Hydra/Controller/Admin.pm index 780835c2..73d884e2 100644 --- a/src/lib/Hydra/Controller/Admin.pm +++ b/src/lib/Hydra/Controller/Admin.pm @@ -34,7 +34,8 @@ sub machines : Chained('admin') PathPart('machines') Args(0) { sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) { my ($self, $c) = @_; - $c->model('DB::Builds')->search({finished => 0, iscurrent => 0, busy => 0})->update({ finished => 1, buildstatus => 4, timestamp => time}); + my $time = time(); + $c->model('DB::Builds')->search({finished => 0, iscurrent => 0, busy => 0})->update({ finished => 1, buildstatus => 4, starttime => $time, stoptime => $time }); $c->res->redirect($c->request->referer // "/admin"); } diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 4a05edd6..0c5fa0bf 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -216,7 +216,7 @@ sub download : Chained('build') PathPart { notFound($c, "Path $path is a directory.") if -d $path; $c->serve_static_file($path); - $c->response->headers->last_modified($c->stash->{build}->timestamp); + $c->response->headers->last_modified($c->stash->{build}->stoptime); } @@ -423,9 +423,12 @@ sub cancel : Chained('build') PathPart Args(0) { # builds as well, but we would have to send a signal or # something to the build process. + my $time = time(); $build->update( - { finished => 1, busy => 0, timestamp => time + { finished => 1, busy => 0 , iscachedbuild => 0, buildstatus => 4 # = cancelled + , starttime => $time + , stoptime => $time }); }); diff --git a/src/lib/Hydra/Controller/Job.pm b/src/lib/Hydra/Controller/Job.pm index db191c33..e062e14a 100644 --- a/src/lib/Hydra/Controller/Job.pm +++ b/src/lib/Hydra/Controller/Job.pm @@ -25,13 +25,13 @@ sub overview : Chained('job') PathPart('') Args(0) { $c->stash->{lastBuilds} = [ $c->stash->{job}->builds->search({ finished => 1 }, - { order_by => 'timestamp DESC', rows => 10, columns => [@buildListColumns] }) ]; + { order_by => 'id DESC', rows => 10, columns => [@buildListColumns] }) ]; $c->stash->{queuedBuilds} = [ $c->stash->{job}->builds->search( { finished => 0 }, { join => ['project'] - , order_by => ["priority DESC", "timestamp"] + , order_by => ["priority DESC", "id"] , '+select' => ['project.enabled'] , '+as' => ['enabled'] } diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 6d5a1005..f49d2723 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -43,7 +43,7 @@ sub queue :Local { my ($self, $c) = @_; $c->stash->{template} = 'queue.tt'; $c->stash->{queue} = [$c->model('DB::Builds')->search( - {finished => 0}, { join => ['project'], order_by => ["priority DESC", "timestamp"], columns => [@buildListColumns], '+select' => ['project.enabled'], '+as' => ['enabled'] })]; + {finished => 0}, { join => ['project'], order_by => ["priority DESC", "id"], columns => [@buildListColumns], '+select' => ['project.enabled'], '+as' => ['enabled'] })]; $c->stash->{flashMsg} //= $c->flash->{buildMsg}; } diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 531e1c1f..cc682665 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -1039,7 +1039,6 @@ sub restartBuild { $build->update( { finished => 0 - , timestamp => time , busy => 0 , locker => "" , iscachedbuild => 0 diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index 1cd86329..cb3840b0 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -28,7 +28,7 @@ our @EXPORT = qw( # Columns from the Builds table needed to render build lists. -Readonly our @buildListColumns => ('id', 'finished', 'timestamp', 'project', 'jobset', 'job', 'nixname', 'system', 'priority', 'busy', 'buildstatus', 'releasename'); +Readonly our @buildListColumns => ('id', 'finished', 'timestamp', 'stoptime', 'project', 'jobset', 'job', 'nixname', 'system', 'priority', 'busy', 'buildstatus', 'releasename'); sub getBuild { diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index e320d735..ababdfd8 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -100,7 +100,7 @@ sub allPrimaryBuilds { my ($project, $primaryJob) = @_; my $allPrimaryBuilds = $project->builds->search( { jobset => $primaryJob->get_column('jobset'), job => $primaryJob->get_column('job'), finished => 1 }, - { order_by => "timestamp DESC" + { order_by => "id DESC" , where => \ attrsToSQL($primaryJob->attrs, "me.id") }); return $allPrimaryBuilds; @@ -153,7 +153,7 @@ sub findLastJobForBuilds { , job => $job->get_column('job'), finished => 1 }, { rows => 1 - , order_by => ["buildstatus", "timestamp"] + , order_by => ["buildstatus", "id"] , where => \ attrsToSQL($job->attrs, "build.id") }) unless defined $thisBuild; diff --git a/src/root/all.tt b/src/root/all.tt index de92fc21..0d065a1e 100644 --- a/src/root/all.tt +++ b/src/root/all.tt @@ -4,7 +4,7 @@ project ? " for project $project.name" : "") %] [% PROCESS common.tt %] -
Showing builds [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + builds.size %] out of [% total %] in order of descending timestamp.
+Showing builds [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + builds.size %] out of [% total %] in order of descending finish time.
[% INCLUDE renderBuildList hideProjectName=project hideJobsetName=jobset hideJobName=job %] [% INCLUDE renderPager %] diff --git a/src/root/build.tt b/src/root/build.tt index 8fdaea8a..9da054fc 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -150,8 +150,8 @@