Debugging postpush.pl

This commit is contained in:
David Brown 2016-06-27 17:43:49 +01:00
parent f383a6c032
commit 71e5e38d89

View file

@ -9,6 +9,16 @@ use POSIX "strftime";
use CGI qw(:standard escapeHTML); use CGI qw(:standard escapeHTML);
use JSON; use JSON;
sub writelog {
my ($msg) = @_;
open(LOG, ">>/tmp/postpush.log") or die "Could not create postpush.log";
flock(LOG, 2) or die "Could not lock postpush.log";
print LOG sprintf("%s %s\n", strftime("%Y/%m/%d %H.%M.%S", localtime), $msg);
close(LOG);
}
writelog "Postpush.";
my $postdata = from_json(param('POSTDATA')); my $postdata = from_json(param('POSTDATA'));
@ -19,16 +29,15 @@ my $name = $postdata->{'head_commit'}->{'author'}->{'name'};
my $branch = $ref; $branch =~ s'^.*\/''; my $branch = $ref; $branch =~ s'^.*\/'';
my $repo = $url; $repo =~ s'^.*\/''; my $repo = $url; $repo =~ s'^.*\/'';
#my $repo="repo"; my $branch="branch"; my $name="name";
writelog "Repository $repo, branch $branch, name $name.";
print header(), print header(),
start_html("Vishap Oberon github post push web hook."), start_html("Vishap Oberon github post push web hook."),
p("Repository $repo, branch $branch, name $name."), p("Repository $repo, branch $branch, name $name."),
end_html(); end_html();
open(LOG, ">>/tmp/postpush.log") or die "Could not create postpush.log";
flock(LOG, 2) or die "Could not lock postpush.log";
printf LOG strftime("%Y/%m/%d %H.%M.%S", localtime), " Repository $repo, branch $branch, name $name.\n";
close(LOG);
system 'ssh root@oberon perl vishap/voc/src/tools/testcoordinator/buildall.pl >/tmp/buildall.log &'; system 'ssh root@oberon perl vishap/voc/src/tools/testcoordinator/buildall.pl >/tmp/buildall.log &';
writelog "Buildall triggered."