* Store the name of the machine that performed a build step in the

BuildSteps table.
This commit is contained in:
Eelco Dolstra 2010-08-31 14:08:59 +00:00
parent c174998a0c
commit 2a69745a88
5 changed files with 31 additions and 6 deletions
src
lib/Hydra
Controller
Schema
root
script
sql

@ -45,7 +45,7 @@ sub view_build : Chained('build') PathPart('') Args(0) {
if (!$build->finished && $build->schedulingInfo->busy) { if (!$build->finished && $build->schedulingInfo->busy) {
my $logfile = $build->schedulingInfo->logfile; my $logfile = $build->schedulingInfo->logfile;
$c->stash->{logtext} = `cat $logfile` if -e $logfile; $c->stash->{logtext} = `cat $logfile` if defined $logfile && -e $logfile;
} }
if (defined $build->resultInfo && $build->resultInfo->iscachedbuild) { if (defined $build->resultInfo && $build->resultInfo->iscachedbuild) {

@ -97,6 +97,13 @@ __PACKAGE__->table("BuildSteps");
is_nullable: 1 is_nullable: 1
size: undef size: undef
=head2 machine
data_type: text
default_value: ''
is_nullable: 0
size: undef
=cut =cut
__PACKAGE__->add_columns( __PACKAGE__->add_columns(
@ -178,6 +185,8 @@ __PACKAGE__->add_columns(
is_nullable => 1, is_nullable => 1,
size => undef, size => undef,
}, },
"machine",
{ data_type => "text", default_value => "''", is_nullable => 0, size => undef },
); );
__PACKAGE__->set_primary_key("build", "stepnr"); __PACKAGE__->set_primary_key("build", "stepnr");
@ -194,7 +203,7 @@ Related object: L<Hydra::Schema::Builds>
__PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }, {}); __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }, {});
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41 # Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-08-31 15:40:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:233eydU0CA3zcJpwDrtwwA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CC/XBHMiRLuQSI+nEFW50g
1; 1;

@ -1,9 +1,14 @@
[% WRAPPER layout.tt title="Logfile" %] [% WRAPPER layout.tt title="Logfile" %]
[% PROCESS common.tt %] [% PROCESS common.tt %]
<h1>Logfile for [% INCLUDE renderFullJobNameOfBuild %] build [% build.id %][%IF step %] step [% step.stepnr %][% END %]</h1> <h1>Build log of [% INCLUDE renderFullJobNameOfBuild %] build <a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a>[%IF step %] step [% step.stepnr %][% END %]</h1>
<p>Below is the logfile of the <a href="[% c.uri_for('/build' build.id) %]">build</a> producing Nix store path <tt>[% step.outpath %]</tt>.</p> <p>
This is the build log of path <tt>[% IF step; step.outpath; ELSE; build.outpath; END %]</tt>.
[% IF step && step.machine %]
It was built on <tt>[% step.machine %]</tt>.
[% END %]
</p>
<div class="buildlog"> <div class="buildlog">
[% logtext -%] [% logtext -%]

@ -202,7 +202,7 @@ sub sendEmailNotification {
print $email->as_string if $ENV{'HYDRA_MAIL_TEST'}; print $email->as_string if $ENV{'HYDRA_MAIL_TEST'};
sendmail($email); sendmail($email);
} }
@ -271,6 +271,15 @@ sub doBuild {
}); });
} }
elsif (/^@\s+build-remote\s+(\S+)\s+(\S+)$/) {
my $drvPathStep = $1;
my $machine = $2;
txn_do($db, sub {
my $step = $build->buildsteps->find({stepnr => $buildSteps{$drvPathStep}}) or die;
$step->update({machine => $machine});
});
}
elsif (/^@\s+build-succeeded\s+(\S+)\s+(\S+)$/) { elsif (/^@\s+build-succeeded\s+(\S+)\s+(\S+)$/) {
my $drvPathStep = $1; my $drvPathStep = $1;
txn_do($db, sub { txn_do($db, sub {

@ -235,6 +235,8 @@ create table BuildSteps (
startTime integer, startTime integer,
stopTime integer, stopTime integer,
machine text not null default '',
primary key (build, stepnr), primary key (build, stepnr),
foreign key (build) references Builds(id) on delete cascade foreign key (build) references Builds(id) on delete cascade
); );