diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index cba1f93d..f9d34628 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -71,7 +71,7 @@ sub build_GET { $c->stash->{cachedBuild} = $cachedBuildStep->build if defined $cachedBuildStep; } - if ($build->finished && 0) { + if ($build->finished) { $c->stash->{prevBuilds} = [$c->model('DB::Builds')->search( { project => $c->stash->{project}->name , jobset => $c->stash->{build}->jobset->name @@ -399,6 +399,32 @@ sub runtime_deps : Chained('buildChain') PathPart('runtime-deps') { } +sub history_graphs : Chained('buildChain') PathPart('history-graphs') { + my ($self, $c) = @_; + my $build = $c->stash->{build}; + if ($build->finished) { + $c->stash->{prevBuilds} = [$c->model('DB::Builds')->search( + { project => $c->stash->{project}->name + , jobset => $c->stash->{build}->jobset->name + , job => $c->stash->{build}->job->name + , 'me.system' => $build->system + , finished => 1 + , buildstatus => 0 + , 'me.id' => { '<=' => $build->id } + } + , { join => "actualBuildStep" + , "+select" => ["actualBuildStep.stoptime - actualBuildStep.starttime"] + , "+as" => ["actualBuildTime"] + , order_by => "me.id DESC" + , rows => 50 + } + ) + ]; + } + $c->stash->{template} = 'build-history-tab.tt'; +} + + sub nix : Chained('buildChain') PathPart('nix') CaptureArgs(0) { my ($self, $c) = @_; diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index c81f6523..8f40917f 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -550,13 +550,13 @@ __PACKAGE__->has_many( { "foreign.build" => "self.id" }, ); -#__PACKAGE__->has_one( -# "actualBuildStep", -# "Hydra::Schema::BuildSteps", -# { 'foreign.outpath' => 'self.outpath' -# , 'foreign.build' => 'self.id' -# }, -#); +__PACKAGE__->has_one( + "actualBuildStep", + "Hydra::Schema::BuildSteps", + { 'foreign.drvpath' => 'self.drvpath' + , 'foreign.build' => 'self.id' + }, +); __PACKAGE__->many_to_many("jobsetevals", "jobsetevalmembers", "eval"); diff --git a/src/root/build-history-tab.tt b/src/root/build-history-tab.tt new file mode 100644 index 00000000..787b460c --- /dev/null +++ b/src/root/build-history-tab.tt @@ -0,0 +1,141 @@ +[% PROCESS common.tt %] +[% PROCESS "product-list.tt" %] +[% USE HTML %] +[% USE Date %] + +

Build time history (in seconds)

+ +
+
+ + + + + +

Store path size history (in MB)

+ +
+
+ + + + diff --git a/src/root/build.tt b/src/root/build.tt index dde0e631..41149704 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -106,7 +106,7 @@
  • Inputs
  • [% IF build.buildsteps %]
  • Build steps
  • [% END %] [% IF build.dependents %]
  • Used by
  • [% END%] - [% IF prevBuilds %]
  • History chart
  • [% END %] +
  • History chart
  • [% IF drvAvailable %]
  • Build dependencies
  • [% END %] [% IF available %]
  • Runtime dependencies
  • [% END %] @@ -407,145 +407,7 @@ [% END %] - [% IF prevBuilds %] -
    -

    Build time history (in seconds)

    - -
    -
    - - - - - -

    Store path size history (in MB)

    - -
    -
    - - - -
    - [% END %] + [% INCLUDE makeLazyTab tabName="tabs-history" uri=c.uri_for('/build' build.id 'history-graphs') %] [% IF drvAvailable %] [% INCLUDE makeLazyTab tabName="tabs-build-deps" uri=c.uri_for('/build' build.id 'build-deps') %]