From adc72d2409bfbfbf89676716e0bbbecb493b7c41 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 25 Feb 2015 16:42:32 +0100 Subject: [PATCH] Record which build a failed build step was propagated from --- src/lib/Hydra/Schema/BuildSteps.pm | 32 ++++++++++++++++++++++++++++-- src/root/build.tt | 1 + src/root/common.tt | 7 +++++-- src/script/hydra-build | 5 +++-- src/sql/hydra.sql | 5 ++++- src/sql/upgrade-32.sql | 3 +++ 6 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 src/sql/upgrade-32.sql diff --git a/src/lib/Hydra/Schema/BuildSteps.pm b/src/lib/Hydra/Schema/BuildSteps.pm index 64bddd07..31f59f3e 100644 --- a/src/lib/Hydra/Schema/BuildSteps.pm +++ b/src/lib/Hydra/Schema/BuildSteps.pm @@ -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 + +=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 => [ diff --git a/src/root/build.tt b/src/root/build.tt index 7f65d8c4..2ddf5fd7 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -56,6 +56,7 @@ Failed: [% HTML.escape(step.errormsg) %] [% 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 %] [% END %] diff --git a/src/root/common.tt b/src/root/common.tt index 194c5278..a5de1fb8 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -168,11 +168,14 @@ BLOCK renderFullBuildLink; END; -BLOCK renderBuildLink; %] -build [% build.id %] +BLOCK renderBuildIdLink; %] +build [% id %] [% END; +BLOCK renderBuildLink; INCLUDE renderBuildIdLink id=build.id; END; + + BLOCK renderBuildStatusIcon; finished = build != undef ? build.finished : 1; busy = busy != undef ? busy : build.busy; diff --git a/src/script/hydra-build b/src/script/hydra-build index 4a977ca5..86ac5865 100755 --- a/src/script/hydra-build +++ b/src/script/hydra-build @@ -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+)$/) { diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 15666623..436cb823 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -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 ); diff --git a/src/sql/upgrade-32.sql b/src/sql/upgrade-32.sql new file mode 100644 index 00000000..8270df0d --- /dev/null +++ b/src/sql/upgrade-32.sql @@ -0,0 +1,3 @@ +alter table BuildSteps + add column propagatedFrom integer, + add foreign key (propagatedFrom) references Builds(id) on delete cascade;