Hydra: In case of failure, also show changes between last succesful build and the first failed build after this

This commit is contained in:
Rob Vermaas 2010-07-14 07:31:14 +00:00
parent 33ef55815e
commit caa0f1a255
3 changed files with 26 additions and 1 deletions

View file

@ -22,6 +22,7 @@ sub build : Chained('/') PathPart CaptureArgs(1) {
$c->stash->{prevBuild} = getPreviousBuild($c, $c->stash->{build}); $c->stash->{prevBuild} = getPreviousBuild($c, $c->stash->{build});
$c->stash->{prevSuccessfulBuild} = getPreviousSuccessfulBuild($c, $c->stash->{build}); $c->stash->{prevSuccessfulBuild} = getPreviousSuccessfulBuild($c, $c->stash->{build});
$c->stash->{firstBrokenBuild} = getNextBuild($c, $c->stash->{prevSuccessfulBuild});
$c->stash->{mappers} = [$c->model('DB::UriRevMapper')->all]; $c->stash->{mappers} = [$c->model('DB::UriRevMapper')->all];

View file

@ -7,7 +7,7 @@ use Hydra::Helper::Nix;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( our @EXPORT = qw(
getBuild getPreviousBuild getPreviousSuccessfulBuild getBuildStats joinWithResultInfo getChannelData getBuild getPreviousBuild getNextBuild getPreviousSuccessfulBuild getBuildStats joinWithResultInfo getChannelData
error notFound error notFound
requireLogin requireProjectOwner requireAdmin requirePost isAdmin isProjectOwner requireLogin requireProjectOwner requireAdmin requirePost isAdmin isProjectOwner
trim trim
@ -35,6 +35,20 @@ sub getPreviousBuild {
return $prevBuild; return $prevBuild;
} }
sub getNextBuild {
my ($c, $build) = @_;
(my $nextBuild) = $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 ASC"});
return $nextBuild;
}
sub getPreviousSuccessfulBuild { sub getPreviousSuccessfulBuild {
my ($c, $build) = @_; my ($c, $build) = @_;
(my $prevBuild) = joinWithResultInfo($c, $c->model('DB::Builds'))->search( (my $prevBuild) = joinWithResultInfo($c, $c->model('DB::Builds'))->search(

View file

@ -183,6 +183,16 @@
[% INCLUDE renderBuildSteps type="Failed" %] [% INCLUDE renderBuildSteps type="Failed" %]
[% END %] [% END %]
[% IF prevSuccessfulBuild && firstBrokenBuild && firstBrokenBuild.id != build.id %]
<h2>Changes</h2>
<p>
Build [% INCLUDE renderFullBuildLink build=firstBrokenBuild %] is the first build failure after the previous successful build of this job. The changes that might have caused the failure are:
</p>
[% INCLUDE renderInputDiff build2=prevSuccessfulBuild , build1=firstBrokenBuild %]
<br />
<p/>
[% END %]
[% IF build.resultInfo.buildstatus != 0 && prevSuccessfulBuild %] [% IF build.resultInfo.buildstatus != 0 && prevSuccessfulBuild %]
<h2>Changes</h2> <h2>Changes</h2>
<p> <p>