From 3b52beca0c38da3faf5012641e0f2bffaa4a06a5 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Mon, 6 Feb 2017 21:47:23 +0000 Subject: Simplify failure detection logic and fix cleanup Especially: - fetch logs when dependencies can not be installed - properly cleanup logs on the build machine in all cases - really discard other architectures if a mandatory one had already failed --- NEWS | 2 ++ ulri | 41 +++++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 2a3e581..50a487f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +- ulri: improve handling of build failures + 0.6.29 - iurt: support chroot tarballs with non gz compression - ulri,emi: fix deletion of src.rpm with non mandatory architectures diff --git a/ulri b/ulri index 07c793a..b41af1e 100755 --- a/ulri +++ b/ulri @@ -315,7 +315,6 @@ foreach my $prefix (keys %pkg_tree) { next bot; } - my $success; my $fail; my $later; @@ -336,7 +335,7 @@ foreach my $prefix (keys %pkg_tree) { } } - if (!$fail) { + if (!$fail && !$later) { my @list = split "\n", sout($remote, "ls $prefix_dir"); my $error; my $done; @@ -374,31 +373,23 @@ foreach my $prefix (keys %pkg_tree) { next if $error; if ($done) { - create_file("$done_dir/${prefix}_$arch.done", "$bot $host"); - $pkg_tree{$prefix}{media}{$media}{done_arch}{$arch} = 1; - $success = 1; - } - - if ($success) { - # Fetch build log and clean remote machine - make_path("$done_dir/$prefix"); - sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); - ssh($remote, "rm -rf $prefix_dir"); if (check_if_mandatory_arch_failed($media, $prefix, $ent, $config)) { + # Discard this arch as another mandatory one failed cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $media, $arch, $config); } else { + create_file("$done_dir/${prefix}_$arch.done", "$bot $host"); + $pkg_tree{$prefix}{media}{$media}{done_arch}{$arch} = 1; + make_path("$done_dir/$prefix"); + sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); $something_finished = 1; } + # Either we already fetched the success logs, or don't care + # as this success was discarded due to another failure. + ssh($remote, "rm -rf $prefix_dir"); + next bot; } } - next bot if $later; - - next bot if $success && !$fail; - - plog('FAIL', "build failed"); - create_file("$done_dir/${prefix}_$arch.fail", "$bot $host"); - $pkg_tree{$prefix}{media}{$media}{failed_arch}{$arch} = 1; make_path($fail_dir); mkdir("$fail_dir/$prefix"); @@ -407,17 +398,23 @@ foreach my $prefix (keys %pkg_tree) { "to $fail_dir/ failed ($!)"); $pkg_tree{$prefix}{media}{$media}{arch}{$arch} = 0; } + # clean the log on the compilation machine + ssh($remote, "rm -rf $prefix_dir"); + + # We got the logs but want to retry so don't record a failure + next bot if $later; cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $media, $arch, $config); + plog('FAIL', "build failed"); + create_file("$done_dir/${prefix}_$arch.fail", "$bot $host"); + $pkg_tree{$prefix}{media}{$media}{failed_arch}{$arch} = 1; + # Notify user if build failed - # if ($user) { warn_about_failure($config, $user, $ent, $arch, $fail_dir, $path, $prefix); } - # clean the log on the compilation machine - ssh($remote, "rm -rf $prefix_dir"); } # end bot } # end path -- cgit v1.2.1