RunCommand: Allow displaying command output
This commit is contained in:
@ -137,6 +137,15 @@ sub view_log : Chained('buildChain') PathPart('log') {
|
||||
}
|
||||
|
||||
|
||||
sub view_runcommand_log : Chained('buildChain') PathPart('runcommand-log') {
|
||||
my ($self, $c, $sha) = @_;
|
||||
|
||||
$c->stash->{is_runcommand} = 1;
|
||||
$c->stash->{log_uri} = $c->uri_for($c->controller('Root')->action_for("runcommandlog"), $sha . "-" . $c->stash->{build}->id);
|
||||
$c->stash->{template} = 'log.tt';
|
||||
}
|
||||
|
||||
|
||||
sub showLog {
|
||||
my ($c, $mode, $finished, $drvPath) = @_;
|
||||
$mode //= "pretty";
|
||||
|
@ -7,6 +7,7 @@ use base 'Hydra::Base::Controller::ListBuilds';
|
||||
use Hydra::Helper::Nix;
|
||||
use Hydra::Helper::CatalystUtils;
|
||||
use Hydra::View::TT;
|
||||
use Hydra::Model::DB;
|
||||
use Nix::Store;
|
||||
use Nix::Config;
|
||||
use Encode;
|
||||
@ -530,4 +531,20 @@ sub log :Local :Args(1) {
|
||||
}
|
||||
}
|
||||
|
||||
sub runcommandlog :Local :Args(1) {
|
||||
my ($self, $c, $filename) = @_;
|
||||
|
||||
my $tail = $c->request->params->{"tail"};
|
||||
|
||||
die if defined $tail && $tail !~ /^[0-9]+$/;
|
||||
|
||||
my $logFile = Hydra::Model::DB::getHydraPath . "/runcommand-logs/" . substr($filename, 0, 2) . "/$filename";
|
||||
if (-f $logFile) {
|
||||
serveLogFile($c, $logFile, $tail);
|
||||
return;
|
||||
} else {
|
||||
notFound($c, "The RunCommand log is not available.");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
Reference in New Issue
Block a user