* Store build duration, handle cached builds.
[?]
Oct 28, 2008, 5:08 PM
WYN733STK5DUQSWHSS6EYZK32KPZII64HLX4NS7TYUSFZ6AAFLGACDependencies
- [2]
N22GPKYT* Put info about logs / build products in the DB. - [3]
UVMFS73T* Some jQuery / CSS hackery. - [4]
ELCI5T2A* Show the latest build for each job. - [5]
J5UVLXOK* Start of a basic Catalyst web interface.
Change contents
- replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 34
# select * from builds as x where timestamp == (select max(timestamp) from builds where name == x.name);$c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "name", where => "timestamp == (select max(timestamp) from builds where name == me.name)"})];# select * from builds as x where timestamp == (select max(timestamp) from builds where jobName == x.jobName);$c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "jobName", where => "timestamp == (select max(timestamp) from builds where jobName == me.jobName)"})]; - replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 43
$c->stash->{builds} = [$c->model('DB::Builds')->search({name => $jobName}, {order_by => "timestamp DESC"})];$c->stash->{builds} = [$c->model('DB::Builds')->search({jobName => $jobName}, {order_by => "timestamp DESC"})]; - replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm at line 28
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:01Br5qFsV84USpzqnjk7cw# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xXiHLBKW5fHl7ukdYeIsTw - replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm at line 28
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jYe9p4xG2Ujnf6TsfeE7tA# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5SPq4at2/NRvbax49TwfDw - replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 15
"name","jobname", - edit in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 23
"iscachedbuild",{ data_type => "integer", is_nullable => 0, size => undef }, - edit in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 27
"errormsg",{ data_type => "text", is_nullable => 0, size => undef },"starttime",{ data_type => "integer", is_nullable => 0, size => undef },"stoptime",{ data_type => "integer", is_nullable => 0, size => undef }, - replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 36
"buildlogs","HydraFrontend::Schema::Buildlogs","buildproducts","HydraFrontend::Schema::Buildproducts", - replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 41
"buildproducts","HydraFrontend::Schema::Buildproducts","buildlogs","HydraFrontend::Schema::Buildlogs", - replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 47
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gxVH+2KWcgU41JOl9BbHFA# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gp6ZZpDA2VzgnNE9NX99dA - replacement in src/HydraFrontend/lib/HydraFrontend/Schema.pm at line 11
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iW1lrJQVyiDiAYhJBy9/iQ# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Fayli8dtSdcAYhfKSZnJwg - replacement in src/HydraFrontend/root/build.tt at line 15
<td>[% build.name %]</td><td>[% build.jobname %]</td> - edit in src/HydraFrontend/root/build.tt at line 24
</tr><tr><th>Duration (seconds):</th><td>[% IF build.iscachedbuild %]<em>(cached build)</em>[% ELSE %][% build.stoptime - build.starttime %][% END %]</td> - edit in src/HydraFrontend/root/index.tt at line 4
<p>Below are the latest builds for each job.</p> - replacement in src/HydraFrontend/root/short-build-info.tt at line 12
<td><a href="[% c.uri_for('/job' build.name) %]"><tt>[% build.name %]</tt></a></td><td><a href="[% c.uri_for('/job' build.jobname) %]"><tt>[% build.jobname %]</tt></a></td> - replacement in src/hydra.schema at line 4
name text not null,jobName text not null, - replacement in src/hydra.schema at line 8
buildStatus integer -- 0 = succeeded, 1 = failure, ...isCachedBuild integer not null, -- booleanbuildStatus integer, -- 0 = succeeded, 1 = Nix build failure, 2 = positive build failureerrorMsg text, -- error message in case of a Nix failurestartTime integer, -- in Unix time, 0 = used cached build resultstopTime integer - replacement in src/scheduler.pl at line 33
if (scalar(@{$dbh->selectall_arrayref("select * from builds where name = ? and outPath = ?", {}, $jobName, $outPath)}) > 0) {if (scalar(@{$dbh->selectall_arrayref("select * from builds where jobName = ? and outPath = ?", {}, $jobName, $outPath)}) > 0) { - edit in src/scheduler.pl at line 37
my $isCachedBuild = 1;my $buildStatus = 0;my $startTime = 0;my $stopTime = 0;if (system("nix-store --check-validity $outPath 2> /dev/null") != 0) {$isCachedBuild = 0; - replacement in src/scheduler.pl at line 46
my $res = system("nix-build $jobsFile --attr $jobName");$startTime = time();my $res = system("nix-build $jobsFile --attr $jobName");$stopTime = time(); - replacement in src/scheduler.pl at line 52
my $buildStatus = $res == 0 ? 0 : 1;$buildStatus = $res == 0 ? 0 : 1;} - replacement in src/scheduler.pl at line 57
$dbh->prepare("insert into builds(timestamp, name, description, drvPath, outPath, buildStatus) values(?, ?, ?, ?, ?, ?)")->execute(time(), $jobName, $description, $drvPath, $outPath, $buildStatus);$dbh->prepare("insert into builds(timestamp, jobName, description, drvPath, outPath, isCachedBuild, buildStatus, errorMsg, startTime, stopTime) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")->execute(time(), $jobName, $description, $drvPath, $outPath, $isCachedBuild, $buildStatus, "", $startTime, $stopTime); - edit in src/scheduler.pl at line 62
my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;if (-e $logPath) {print " LOG $logPath\n";$dbh->prepare("insert into buildLogs(buildId, logPhase, path, type) values(?, ?, ?, ?)")->execute($buildId, "full", $logPath, "raw");} - edit in src/scheduler.pl at line 75
my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;if (-e $logPath) {print " LOG $logPath\n";$dbh->prepare("insert into buildLogs(buildId, logPhase, path, type) values(?, ?, ?, ?)")->execute($buildId, "full", $logPath, "raw");}