From cfcd4507544f1c57802925255ecdfb9234f1feee Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Sun, 13 Nov 2022 18:39:34 +0000 Subject: Increase robustness when scp fails Do not remove lock file and mark build as done until we copied all the files. --- lib/Iurt/Queue.pm | 10 ++++++++++ lib/Iurt/Ulri.pm | 8 ++++++++ 2 files changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/Iurt/Queue.pm b/lib/Iurt/Queue.pm index 2f1e968..585294e 100644 --- a/lib/Iurt/Queue.pm +++ b/lib/Iurt/Queue.pm @@ -15,6 +15,7 @@ our @EXPORT = qw( check_if_all_archs_processed check_if_mandatory_arch_failed load_lock_file_data + record_bot_complete remove_bot_from_package ); @@ -183,6 +184,15 @@ sub remove_bot_from_package { @{$ent->{media}{$media}{bot}} = grep { $_->{host} ne $host || $_->{pid} != $pid} @{$ent->{media}{$media}{bot}}; } +sub record_bot_complete { + my ($run, $bot, $arch, $lock_file, $prefix, $ent, $media, $host, $pid) = @_; + plog('INFO', "delete lock file for $prefix on $host/$arch"); + unlink $lock_file; + $run->{bot}{$host}{$bot} = 0; + remove_bot_from_package($ent, $media, $host, $pid); + $ent->{media}{$media}{arch}{$arch} = 0; +} + sub get_upload_tree_state { our ($config) = @_; diff --git a/lib/Iurt/Ulri.pm b/lib/Iurt/Ulri.pm index 6d4e38f..f2e014c 100755 --- a/lib/Iurt/Ulri.pm +++ b/lib/Iurt/Ulri.pm @@ -12,6 +12,7 @@ use strict; our @EXPORT = qw( build_package + fetch_logs_and_cleanup warn_about_failure ); @@ -144,6 +145,13 @@ sub get_pid_from_file { $pid; } +sub fetch_logs_and_cleanup { + my ($remote, $remote_dir, $target_dir) = @_; + make_path($target_dir); + sget($remote, "$remote_dir/log/*", $target_dir); + ssh($remote, "rm -rf $remote_dir"); +} + sub warn_about_failure { my ($config, $user, $ent, $arch, $fail_dir, $path, $prefix) = @_; my $text = join("\n", "Build of the following packages failed:\n", map { "- $_" } @{$ent->{srpms}}) . "\n"; -- cgit v1.2.1