hydra-server: Support logs in S3

This commit is contained in:
Eelco Dolstra
2017-04-05 17:55:56 +02:00
parent 4f11cf45dc
commit fec895a642
13 changed files with 146 additions and 136 deletions

View File

@ -13,10 +13,17 @@ sub process {
my $fh = new IO::Handle;
my $tail = int($c->stash->{tail} // "0");
if ($logPath =~ /\.bz2$/) {
open $fh, "bzip2 -dc < '$logPath' |" or die;
my $doTail = $tail ? " tail -n '$tail' |" : "";
open $fh, "bzip2 -dc < '$logPath' | $doTail" or die;
} else {
open $fh, "<$logPath" or die;
if ($tail) {
open $fh, "tail -n '$tail' '$logPath' |" or die;
} else {
open $fh, "<$logPath" or die;
}
}
binmode($fh);

View File

@ -13,17 +13,18 @@ __PACKAGE__->config(
sub buildLogExists {
my ($self, $c, $build) = @_;
return 1 if defined $c->config->{log_prefix};
my @outPaths = map { $_->path } $build->buildoutputs->all;
return defined findLog($c, $build->drvpath, @outPaths);
}
sub buildStepLogExists {
my ($self, $c, $step) = @_;
return 1 if defined $c->config->{log_prefix};
my @outPaths = map { $_->path } $step->buildstepoutputs->all;
return defined findLog($c, $step->drvpath, @outPaths);
}
sub stripSSHUser {
my ($self, $c, $name) = @_;
if ($name =~ /^.*@(.*)$/) {