From 6874c65383161833faefb1e1af837a26c1714784 Mon Sep 17 00:00:00 2001 From: Jan Baier Date: Fri, 20 Sep 2024 11:33:45 +0200 Subject: [PATCH 1/3] Upload docker logs when the build fails Reference: https://progress.opensuse.org/issues/165992 --- tests/containers/build.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/containers/build.pm b/tests/containers/build.pm index d6648c7f..d537fd81 100644 --- a/tests/containers/build.pm +++ b/tests/containers/build.pm @@ -1,11 +1,17 @@ -use Mojo::Base 'openQAcoretest'; +use Mojo::Base 'openQAcoretest', -signatures; use testapi; sub run { # The maximum of the retry is 3810 seconds assert_script_run('retry -s 30 -r 7 -e -- git clone https://github.com/os-autoinst/openQA.git', timeout => 4000); - assert_script_run("retry -s 30 -r 7 -e -- docker build openQA/container/$_ -t openqa_$_", timeout => 4000) for qw(webui worker); - assert_script_run('retry -s 30 -r 7 -e -- docker build openQA/container/openqa_data -t openqa_data', timeout => 4000); + assert_script_run("retry -s 30 -r 7 -e -- bash -o pipefail -c 'docker build openQA/container/$_ -t openqa_$_ --progress=plain 2>&1 | tee docker_build.txt'", timeout => 4000) for qw(webui worker); + assert_script_run("retry -s 30 -r 7 -e -- bash -o pipefail -c 'docker build openQA/container/openqa_data -t openqa_data --progress=plain 2>&1 | tee docker_build.txt'", timeout => 4000); +} + +sub post_fail_hook ($self) { + save_screenshot; + upload_logs 'docker_build.txt'; + $self->SUPER::post_fail_hook; } 1; From 0fbbb93bac20b9afdaf355174392d0912320fb3b Mon Sep 17 00:00:00 2001 From: Jan Baier Date: Fri, 20 Sep 2024 14:09:38 +0200 Subject: [PATCH 2/3] Make docker build logs available for auto review --- tests/containers/build.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/containers/build.pm b/tests/containers/build.pm index d537fd81..7e63d7f0 100644 --- a/tests/containers/build.pm +++ b/tests/containers/build.pm @@ -11,6 +11,8 @@ sub run { sub post_fail_hook ($self) { save_screenshot; upload_logs 'docker_build.txt'; + my $log = script_output('cat docker_build.txt'); + record_info('docker build', $log, result => 'fail'); $self->SUPER::post_fail_hook; } From 03599947576f8bd8e7a55589b06b4505288f16c6 Mon Sep 17 00:00:00 2001 From: Jan Baier Date: Fri, 20 Sep 2024 14:30:00 +0200 Subject: [PATCH 3/3] Detect and reference poo#165992 if applicable Reference: https://progress.opensuse.org/issues/165992 --- tests/containers/build.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/containers/build.pm b/tests/containers/build.pm index 7e63d7f0..87562f05 100644 --- a/tests/containers/build.pm +++ b/tests/containers/build.pm @@ -13,6 +13,8 @@ sub post_fail_hook ($self) { upload_logs 'docker_build.txt'; my $log = script_output('cat docker_build.txt'); record_info('docker build', $log, result => 'fail'); + record_info('poo#165992', 'Valid metadata not found at specified URL: https://progress.opensuse.org/issues/165992', result => 'fail') + if $log =~ m/Valid metadata not found at specified URL/; $self->SUPER::post_fail_hook; }