commit 308a0861a110c92a1f1378b6577e8db9a9f11c6c Author: Nicolas Vigier boklm@torproject.org Date: Fri Feb 12 20:05:39 2021 +0100
Bug 40018: rsync to tbb-nightlies-master after each build --- config/tb-build-01.torproject.org | 17 +++++++++++++++++ tools/rsync-to-tbb-nightlies-master | 16 ++++++++++++++++ 2 files changed, 33 insertions(+)
diff --git a/config/tb-build-01.torproject.org b/config/tb-build-01.torproject.org index 62f8bc1..c348e69 100644 --- a/config/tb-build-01.torproject.org +++ b/config/tb-build-01.torproject.org @@ -2,6 +2,8 @@ use strict; use FindBin; use DateTime; +use IO::CaptureOutput qw(capture_exec); +use File::Slurp; use TBBTestSuite::TestSuite::TorBrowserBuild;
my $date = DateTime->now->ymd; @@ -11,6 +13,20 @@ my $name = "tor-browser-$date"; my $builds_dir_root = '/home/tb-builder/nightly-builds'; my $reports_dir = "$builds_dir_root/reports";
+my $run_rsync = sub { + # we fork to run the rsync in the background + # we do a double fork to prevent having zombie processes + my $pid = fork; + if ($pid) { + waitpid($pid, 0); + return; + } + exit 0 if fork; + + capture_exec("$FindBin::Bin/tools/rsync-to-tbb-nightlies-master"); + exit; +}; + if (-d "$reports_dir/r/$name") { print "Doing nothing: $name already done\n"; return ( args => [] ); @@ -34,5 +50,6 @@ my %res = ( 'email-report' => 1, 'email-to' => [ 'boklm@torproject.org', 'gk@torproject.org', 'sysrqb@torproject.org', ], 'email-from' => 'Tor Browser Nightly Builds tb-builder@tb-build-01.torproject.org', + 'test_post' => $run_rsync, ); %res; diff --git a/tools/rsync-to-tbb-nightlies-master b/tools/rsync-to-tbb-nightlies-master new file mode 100755 index 0000000..996996d --- /dev/null +++ b/tools/rsync-to-tbb-nightlies-master @@ -0,0 +1,16 @@ +#!/usr/bin/perl -w +use strict; +use FindBin; +use Path::Tiny; + +my $lockfile = "$FindBin::Bin/rsync-to-tbb-nightlies-master.lock"; +if (-f $lockfile) { + my $oldpid = path($lockfile)->slurp_utf8; + exit if kill 0, $oldpid; + unlink $lockfile; +} +path($lockfile)->spew_utf8($$); + +system('rsync', '-aH', '--delete-before', '/home/tb-builder/nightly-builds/', + 'tbb-nightlies@tbb-nightlies-master.torproject.org:/'); +unlink $lockfile;