forked from lix-project/hydra
* Provide access to the raw, non-pretty-printed logfiles.
Unfortunately necessary for large logs.
This commit is contained in:
parent
4404800ad8
commit
eeddf5752d
|
@ -39,43 +39,49 @@ sub view_build : Chained('build') PathPart('') Args(0) {
|
|||
}
|
||||
|
||||
|
||||
sub view_nixlog : Chained('build') PathPart('nixlog') Args(1) {
|
||||
my ($self, $c, $stepnr) = @_;
|
||||
sub view_nixlog : Chained('build') PathPart('nixlog') {
|
||||
my ($self, $c, $stepnr, $mode) = @_;
|
||||
|
||||
my $step = $c->stash->{build}->buildsteps->find({stepnr => $stepnr});
|
||||
notFound($c, "Build doesn't have a build step $stepnr.") if !defined $step;
|
||||
|
||||
$c->stash->{template} = 'log.tt';
|
||||
$c->stash->{step} = $step;
|
||||
|
||||
# !!! should be done in the view (as a TT plugin).
|
||||
$c->stash->{logtext} = loadLog($c, $step->logfile);
|
||||
showLog($c, $step->logfile, $mode);
|
||||
}
|
||||
|
||||
|
||||
sub view_log : Chained('build') PathPart('log') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
sub view_log : Chained('build') PathPart('log') {
|
||||
my ($self, $c, $mode) = @_;
|
||||
|
||||
error($c, "Build didn't produce a log.") if !defined $c->stash->{build}->resultInfo->logfile;
|
||||
|
||||
$c->stash->{template} = 'log.tt';
|
||||
|
||||
# !!! should be done in the view (as a TT plugin).
|
||||
$c->stash->{logtext} = loadLog($c, $c->stash->{build}->resultInfo->logfile);
|
||||
showLog($c, $c->stash->{build}->resultInfo->logfile, $mode);
|
||||
}
|
||||
|
||||
|
||||
sub loadLog {
|
||||
my ($c, $path) = @_;
|
||||
sub showLog {
|
||||
my ($c, $path, $mode) = @_;
|
||||
|
||||
notFound($c, "Log file $path no longer exists.") unless -f $path;
|
||||
|
||||
# !!! quick hack
|
||||
my $pipeline = ($path =~ /.bz2$/ ? "cat $path | bzip2 -d" : "cat $path")
|
||||
. " | nix-log2xml | xsltproc " . $c->path_to("xsl/mark-errors.xsl") . " -"
|
||||
. " | xsltproc " . $c->path_to("xsl/log2html.xsl") . " - | tail -n +2";
|
||||
if ($mode eq "") {
|
||||
# !!! quick hack
|
||||
my $pipeline = ($path =~ /.bz2$/ ? "cat $path | bzip2 -d" : "cat $path")
|
||||
. " | nix-log2xml | xsltproc " . $c->path_to("xsl/mark-errors.xsl") . " -"
|
||||
. " | xsltproc " . $c->path_to("xsl/log2html.xsl") . " - | tail -n +2";
|
||||
|
||||
return `$pipeline`;
|
||||
$c->stash->{template} = 'log.tt';
|
||||
$c->stash->{logtext} = `$pipeline`;
|
||||
}
|
||||
|
||||
elsif ($mode eq "raw") {
|
||||
$c->serve_static_file($path);
|
||||
}
|
||||
|
||||
else {
|
||||
error($c, "Unknown log display mode `$mode'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
<th>Logfile:</th>
|
||||
<td>
|
||||
<a href="[% c.uri_for('/build' build.id 'log') %]"><strong>Available</strong></a>
|
||||
(<a href="[% c.uri_for('/build' build.id 'log' 'raw') %]">raw</a>)
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
@ -249,7 +250,7 @@
|
|||
<span class="error">Failed: [% HTML.escape(step.errormsg) %]</span>
|
||||
[% END %]
|
||||
[% IF step.logfile %]
|
||||
(<a href="[% log %]">log</a>)
|
||||
(<a href="[% log %]">log</a>, <a href="[% "$log/raw" %]">raw</a>)
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -33,14 +33,12 @@
|
|||
[% BLOCK renderFullJobName %]
|
||||
<tt>
|
||||
[% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %]:[% INCLUDE renderJobName %]
|
||||
</a>
|
||||
</tt>
|
||||
[% END %]
|
||||
|
||||
|
||||
[% BLOCK renderFullJobNameOfBuild %]
|
||||
<tt>
|
||||
[% INCLUDE renderFullJobName project=build.get_column("project") jobset = build.get_column("jobset") job = build.get_column("job") %]
|
||||
</a>
|
||||
[% END %]
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
[% WRAPPER layout.tt title="Logfile" %]
|
||||
[% PROCESS common.tt %]
|
||||
|
||||
<h1>Logfile for <tt>[% build.project.name %]:[% build.job %]</tt> build [% build.id %][%IF step %], step [% step.stepnr %] (<tt>[% step.outpath %]</tt>)[% END %]</h1>
|
||||
<h1>Logfile for [% INCLUDE renderFullJobNameOfBuild %] build [% build.id %][%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>
|
||||
|
||||
<div class="buildlog">
|
||||
[% logtext -%]
|
||||
|
|
Loading…
Reference in a new issue