diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 0e0471ee..e94f1559 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -15,6 +15,8 @@ sub build : Chained('/') PathPart CaptureArgs(1) { $c->stash->{id} = $id; $c->stash->{build} = getBuild($c, $id); + $c->stash->{prevBuild} = getPreviousBuild($c, $c->stash->{build}); + $c->stash->{prevSuccessfulBuild} = getPreviousSuccessfulBuild($c, $c->stash->{build}); notFound($c, "Build with ID $id doesn't exist.") if !defined $c->stash->{build}; @@ -22,7 +24,6 @@ sub build : Chained('/') PathPart CaptureArgs(1) { $c->stash->{project} = $c->stash->{build}->project; } - sub view_build : Chained('build') PathPart('') Args(0) { my ($self, $c) = @_; diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index 7de3a8ee..f838812c 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -7,7 +7,7 @@ use Hydra::Helper::Nix; our @ISA = qw(Exporter); our @EXPORT = qw( - getBuild getBuildStats joinWithResultInfo getChannelData + getBuild getPreviousBuild getPreviousSuccessfulBuild getBuildStats joinWithResultInfo getChannelData error notFound requireLogin requireProjectOwner requireAdmin requirePost trim @@ -21,6 +21,34 @@ sub getBuild { return $build; } +sub getPreviousBuild { + my ($c, $build) = @_; + (my $prevBuild) = $c->model('DB::Builds')->search( + { finished => 1 + , system => $build->system + , project => $build->project->name + , jobset => $build->jobset->name + , job => $build->job->name + , 'me.id' => { '<' => $build->id } + }, {rows => 1, order_by => "id DESC"}); + + return $prevBuild; +} + +sub getPreviousSuccessfulBuild { + my ($c, $build) = @_; + (my $prevBuild) = joinWithResultInfo($c, $c->model('DB::Builds'))->search( + { finished => 1 + , system => $build->system + , project => $build->project->name + , jobset => $build->jobset->name + , job => $build->job->name + , buildstatus => 0 + , 'me.id' => { '<' => $build->id } + }, {rows => 1, order_by => "id DESC"}); + + return $prevBuild; +} sub getBuildStats { my ($c, $builds) = @_; diff --git a/src/root/build.tt b/src/root/build.tt index 1473ddef..a497362e 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -175,7 +175,7 @@ [% END %] - [% IF !build.finished %] + [% IF !build.finished %] [% INCLUDE renderBuildSteps type="Running" %] [% END %] @@ -383,6 +383,17 @@ [% END -%] + + [% IF prevBuild %] +
Name | Change | ||
---|---|---|---|
[% bi1.name %] | ++ [% INCLUDE renderInputValue input=bi1 %] to [% INCLUDE renderInputValue input=bi2 %] + | + [% END %] + [% ELSE %] +[% bi1.name %] | +Changed input type from '[% type = bi1.type; inputTypes.$type %]' to '[% type = bi2.type; inputTypes.$type %]' | + [% END %] +
[% bi1.name %] | Input not present in this build. |