From fdc046156128020f52dd14dfc75e7f0b19735bea Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Thu, 5 Dec 2024 13:07:20 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Add=20missing=20"=E2=80=A6=20days"=20in=20m?= =?UTF-8?q?essage=20when=20skipping=20submissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related ticket: https://progress.opensuse.org/issues/167395 --- os-autoinst-obs-auto-submit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os-autoinst-obs-auto-submit b/os-autoinst-obs-auto-submit index f37228c..4547ec7 100755 --- a/os-autoinst-obs-auto-submit +++ b/os-autoinst-obs-auto-submit @@ -183,7 +183,7 @@ fi # throttle number of submissions to allow only one SR within a certain number of days if [[ $throttle_days != 0 ]] && $osc request list --project "$dst_project" --type submit --state new,review --mine --days "$throttle_days" | grep --quiet 'Created by'; then - echo "Skipping submission, there is still a pending SR younger than $throttle_days." + echo "Skipping submission, there is still a pending SR younger than $throttle_days days." exit 0 fi From 97d2600c23169cbeba798854e8b55449ba7e2da8 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Thu, 5 Dec 2024 13:11:31 +0100 Subject: [PATCH 2/3] Fix sporadic error about broken pipe when checking recent SRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code sometimes runs into: ``` Exception ignored in: BrokenPipeError: [Errno 32] Broken pipe Retrying up to 3 more times after sleeping 3s … ``` This is easily reproducible by adding the condition into a separate script and running it a few times. The additional `cat > /dev/null` which this change introduces seems to fix the issue. Related ticket: https://progress.opensuse.org/issues/167395 --- os-autoinst-obs-auto-submit | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/os-autoinst-obs-auto-submit b/os-autoinst-obs-auto-submit index 4547ec7..004a82f 100755 --- a/os-autoinst-obs-auto-submit +++ b/os-autoinst-obs-auto-submit @@ -182,7 +182,13 @@ if [[ -e job_post_skip_submission ]]; then fi # throttle number of submissions to allow only one SR within a certain number of days -if [[ $throttle_days != 0 ]] && $osc request list --project "$dst_project" --type submit --state new,review --mine --days "$throttle_days" | grep --quiet 'Created by'; then +if [[ $throttle_days != 0 ]] && $osc request list --project "$dst_project" --type submit --state new,review --mine --days "$throttle_days" \ + | { + grep --quiet 'Created by' + rc=$? + cat > /dev/null # keep consuming input so osc does not run into "BrokenPipeError: [Errno 32] Broken pipe" + exit $rc + }; then echo "Skipping submission, there is still a pending SR younger than $throttle_days days." exit 0 fi From 6112aa488dd9f1c706e8170df6f87b23024f1cfe Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Thu, 5 Dec 2024 15:18:15 +0100 Subject: [PATCH 3/3] Simplify fix for sporadic error when checking recent SRs Related ticket: https://progress.opensuse.org/issues/167395 --- os-autoinst-obs-auto-submit | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/os-autoinst-obs-auto-submit b/os-autoinst-obs-auto-submit index 004a82f..4b0f384 100755 --- a/os-autoinst-obs-auto-submit +++ b/os-autoinst-obs-auto-submit @@ -182,13 +182,8 @@ if [[ -e job_post_skip_submission ]]; then fi # throttle number of submissions to allow only one SR within a certain number of days -if [[ $throttle_days != 0 ]] && $osc request list --project "$dst_project" --type submit --state new,review --mine --days "$throttle_days" \ - | { - grep --quiet 'Created by' - rc=$? - cat > /dev/null # keep consuming input so osc does not run into "BrokenPipeError: [Errno 32] Broken pipe" - exit $rc - }; then +# note: Avoid using `grep --quiet` here to keep consuming input so osc does not run into "BrokenPipeError: [Errno 32] Broken pipe". +if [[ $throttle_days != 0 ]] && $osc request list --project "$dst_project" --type submit --state new,review --mine --days "$throttle_days" | grep 'Created by' > /dev/null; then echo "Skipping submission, there is still a pending SR younger than $throttle_days days." exit 0 fi