Record which build a failed build step was propagated from

This commit is contained in:
Eelco Dolstra 2015-02-25 16:42:32 +01:00
parent 48af914e28
commit adc72d2409
6 changed files with 46 additions and 7 deletions

View file

@ -92,6 +92,12 @@ __PACKAGE__->table("BuildSteps");
data_type: 'text'
is_nullable: 1
=head2 propagatedfrom
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
=cut
__PACKAGE__->add_columns(
@ -117,6 +123,8 @@ __PACKAGE__->add_columns(
{ data_type => "text", default_value => "", is_nullable => 0 },
"system",
{ data_type => "text", is_nullable => 1 },
"propagatedfrom",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
);
=head1 PRIMARY KEY
@ -165,9 +173,29 @@ __PACKAGE__->has_many(
undef,
);
=head2 propagatedfrom
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OZsXJniZ/7EB2iSz7p5y4A
Type: belongs_to
Related object: L<Hydra::Schema::Builds>
=cut
__PACKAGE__->belongs_to(
"propagatedfrom",
"Hydra::Schema::Builds",
{ id => "propagatedfrom" },
{
is_deferrable => 0,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "NO ACTION",
},
);
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2015-02-25 16:27:20
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZbOxzCzFN7fIT9M2BFY0iQ
my %hint = (
columns => [

View file

@ -56,6 +56,7 @@
<span class="error">Failed: [% HTML.escape(step.errormsg) %]</span>
[% END %]
[%%] [%+ IF has_log; INCLUDE renderLogLinks url=log inRow=1; END %]
[%+ IF step.propagatedfrom; %](propagated from [% INCLUDE renderBuildIdLink id=step.propagatedfrom.get_column('id') %])[% END %]
</td>
</tr>
[% END %]

View file

@ -168,11 +168,14 @@ BLOCK renderFullBuildLink;
END;
BLOCK renderBuildLink; %]
<a href="[% c.uri_for('/build' build.id) %]">build [% build.id %]</a>
BLOCK renderBuildIdLink; %]
<a href="[% c.uri_for('/build' id) %]">build [% id %]</a>
[% END;
BLOCK renderBuildLink; INCLUDE renderBuildIdLink id=build.id; END;
BLOCK renderBuildStatusIcon;
finished = build != undef ? build.finished : 1;
busy = busy != undef ? busy : build.busy;

View file

@ -39,7 +39,7 @@ sub nextFreeStepNr {
sub failDependents {
my ($drvPath, $status, $errorMsg, $dependents, $startTime, $stopTime, $machine) = @_;
my ($drvPath, $status, $errorMsg, $dependents, $startTime, $stopTime, $machine, $propagatedFrom) = @_;
# Get the referrer closure of $drvPath.
my $dependentDrvs = Set::Scalar->new(computeFSClosure(1, 0, $drvPath));
@ -75,6 +75,7 @@ sub failDependents {
, stoptime => $stopTime
, errormsg => $errorMsg
, machine => $machine
, propagatedfrom => $propagatedFrom->id
});
addBuildStepOutputs($step);
@ -236,7 +237,7 @@ sub doBuild {
});
# Immediately fail all builds that depend on this derivation.
failDependents($drvPathStep, $status, $errorMsg, $dependents, $stepStartTime, $stepStopTime, $machine);
failDependents($drvPathStep, $status, $errorMsg, $dependents, $stepStartTime, $stepStopTime, $machine, $build);
}
elsif (/^@\s+substituter-started\s+(\S+)\s+(\S+)$/) {

View file

@ -233,8 +233,11 @@ create table BuildSteps (
machine text not null default '',
system text,
propagatedFrom integer,
primary key (build, stepnr),
foreign key (build) references Builds(id) on delete cascade
foreign key (build) references Builds(id) on delete cascade,
foreign key (propagatedFrom) references Builds(id) on delete cascade
);

3
src/sql/upgrade-32.sql Normal file
View file

@ -0,0 +1,3 @@
alter table BuildSteps
add column propagatedFrom integer,
add foreign key (propagatedFrom) references Builds(id) on delete cascade;