forked from lix-project/hydra
This commit is contained in:
parent
ecd0ba74e9
commit
632bb24687
|
@ -80,6 +80,11 @@ sub build :Local {
|
|||
$c->stash->{template} = 'build.tt';
|
||||
$c->stash->{build} = $build;
|
||||
$c->stash->{id} = $id;
|
||||
|
||||
if (!$build->finished && $build->schedulingInfo->busy) {
|
||||
my $logfile = $build->schedulingInfo->logfile;
|
||||
$c->stash->{logtext} = `cat $logfile`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
<h1>
|
||||
Job <tt>[% build.project.name %]:[% build.attrname %]</tt> build [% id %]
|
||||
[% IF !build.finished %]
|
||||
(scheduled)
|
||||
[% IF build.schedulingInfo.busy %]
|
||||
(currently building)
|
||||
[% ELSE %]
|
||||
(scheduled)
|
||||
[% END %]
|
||||
[% END %]
|
||||
</h1>
|
||||
|
||||
|
@ -20,6 +24,27 @@
|
|||
<th>Time added:</th>
|
||||
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status:</th>
|
||||
<td>
|
||||
[% IF build.finished %]
|
||||
[% IF build.resultInfo.buildstatus == 0 %]
|
||||
<img src="/static/images/success.gif" />
|
||||
<strong>Success</strong>
|
||||
[% ELSIF build.resultInfo.buildstatus == 1 %]
|
||||
<img src="/static/images/failure.gif" />
|
||||
<strong>Build returned a non-zero exit code</strong>
|
||||
[% ELSE %]
|
||||
<img src="/static/images/failure.gif" />
|
||||
<strong>Build failed</strong>
|
||||
[% END %]
|
||||
[% ELSIF build.schedulingInfo.busy %]
|
||||
<strong>Build in progress</strong>
|
||||
[% ELSE %]
|
||||
<strong>Scheduled to be built</strong>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Project:</th>
|
||||
<td><a href="[% c.uri_for('/project' build.project.name) %]"><tt>[% build.project.name %]</tt></a></td>
|
||||
|
@ -67,21 +92,17 @@
|
|||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status:</th>
|
||||
<td>
|
||||
[% IF build.resultInfo.buildstatus == 0 %]
|
||||
<img src="/static/images/success.gif" />
|
||||
[% ELSE %]
|
||||
<img src="/static/images/failure.gif" />
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% ELSE %]
|
||||
<tr>
|
||||
<th>Priority:</th>
|
||||
<td>[% build.schedulingInfo.priority %]</td>
|
||||
</tr>
|
||||
[% IF build.schedulingInfo.busy %]
|
||||
<tr>
|
||||
<th>Logfile:</th>
|
||||
<td>[% build.schedulingInfo.logfile %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</table>
|
||||
|
||||
|
@ -115,6 +136,10 @@
|
|||
|
||||
[% IF build.finished %]
|
||||
|
||||
|
||||
[% IF build.buildproducts %]
|
||||
|
||||
|
||||
<h2>Build products</h2>
|
||||
|
||||
<ul class="productList">
|
||||
|
@ -141,6 +166,8 @@
|
|||
|
||||
</ul>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
<h2>Logs</h2>
|
||||
|
||||
|
@ -179,6 +206,17 @@
|
|||
[% END %]
|
||||
|
||||
|
||||
[% ELSIF build.schedulingInfo.busy %]
|
||||
|
||||
|
||||
<h2>Log</h2>
|
||||
|
||||
<!-- !!! escaping -->
|
||||
<pre class="buildlog">
|
||||
[% logtext -%]
|
||||
</pre>
|
||||
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
[% WRAPPER layout.tt title="Hydra Overview" %]
|
||||
[% USE date %]
|
||||
|
||||
|
||||
<h1>Queue</h1>
|
||||
|
||||
[% IF scheduled.size == 0 %]
|
||||
|
||||
<p>The queue is empty.</p>
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr><th>#</th><th>Priority</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
|
||||
|
@ -13,7 +20,7 @@
|
|||
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
|
||||
<td>[% build.schedulingInfo.priority %]</td>
|
||||
<td><tt>[% build.project.name %]</tt></td>
|
||||
<td><tt>[% build.jobset.name %]</tt></td>
|
||||
<td><tt>[% build.attrname %]</tt></td>
|
||||
<td><tt>[% build.system %]</tt></td>
|
||||
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
|
||||
<td>[% build.description %]</td>
|
||||
|
@ -22,6 +29,9 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
<h1>Job status</h1>
|
||||
|
||||
<p>Below are the latest builds for each job.</p>
|
||||
|
@ -37,6 +47,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h1>All builds</h1>
|
||||
|
||||
<p>Number of builds: [% allBuilds.size %]</p>
|
||||
|
@ -52,6 +63,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h1>Projects</h1>
|
||||
|
||||
<ul>
|
||||
|
@ -60,4 +72,5 @@
|
|||
[% END -%]
|
||||
</ul>
|
||||
|
||||
|
||||
[% END %]
|
||||
|
|
10
src/build.pl
10
src/build.pl
|
@ -32,8 +32,6 @@ sub doBuild {
|
|||
|
||||
$startTime = time();
|
||||
|
||||
print " BUILDING\n";
|
||||
|
||||
my $res = system("nix-store --realise $drvPath");
|
||||
|
||||
$stopTime = time();
|
||||
|
@ -66,7 +64,7 @@ sub doBuild {
|
|||
|
||||
my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;
|
||||
if (-e $logPath) {
|
||||
print " LOG $logPath\n";
|
||||
print "found log $logPath\n";
|
||||
$db->resultset('Buildlogs')->create(
|
||||
{ build => $build->id
|
||||
, logphase => "full"
|
||||
|
@ -79,7 +77,7 @@ sub doBuild {
|
|||
|
||||
if (-e "$outPath/log") {
|
||||
foreach my $logPath (glob "$outPath/log/*") {
|
||||
print " LOG $logPath\n";
|
||||
print "found log $logPath\n";
|
||||
$db->resultset('Buildlogs')->create(
|
||||
{ build => $build->id
|
||||
, logphase => basename($logPath)
|
||||
|
@ -105,7 +103,7 @@ sub doBuild {
|
|||
});
|
||||
}
|
||||
close LIST;
|
||||
} else {
|
||||
} elsif ($buildStatus == 0) {
|
||||
$db->resultset('Buildproducts')->create(
|
||||
{ build => $build->id
|
||||
, type => "nix-build"
|
||||
|
@ -144,9 +142,7 @@ die unless $build;
|
|||
# Do the build. If it throws an error, unlock the build so that it
|
||||
# can be retried.
|
||||
eval {
|
||||
print "BUILD\n";
|
||||
doBuild $build;
|
||||
print "DONE\n";
|
||||
};
|
||||
if ($@) {
|
||||
warn $@;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#! @perl@ -w
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
use POSIX qw(dup2);
|
||||
use HydraFrontend::Schema;
|
||||
|
||||
|
@ -31,6 +32,7 @@ sub checkJobs {
|
|||
print "looking for runnable jobs...\n";
|
||||
|
||||
my $job;
|
||||
my $logfile;
|
||||
|
||||
$db->txn_do(sub {
|
||||
|
||||
|
@ -42,8 +44,11 @@ sub checkJobs {
|
|||
|
||||
if (scalar @jobs > 0) {
|
||||
$job = $jobs[0];
|
||||
$logfile = getcwd . "/logs/" . $job->id;
|
||||
unlink $logfile;
|
||||
$job->schedulingInfo->busy(1);
|
||||
$job->schedulingInfo->locker($$);
|
||||
$job->schedulingInfo->logfile($logfile);
|
||||
$job->schedulingInfo->update;
|
||||
}
|
||||
|
||||
|
@ -58,7 +63,7 @@ sub checkJobs {
|
|||
my $child = fork();
|
||||
die unless defined $child;
|
||||
if ($child == 0) {
|
||||
open LOG, ">logs/$id" or die;
|
||||
open LOG, ">$logfile" or die;
|
||||
POSIX::dup2(fileno(LOG), 1) or die;
|
||||
POSIX::dup2(fileno(LOG), 2) or die;
|
||||
exec("perl", "-IHydraFrontend/lib", "-w",
|
||||
|
|
Loading…
Reference in a new issue