From 70bfb536bcaa68f2632f6913ff0aba8f9db5b9ed Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Thu, 29 Jan 2026 13:53:53 -0500 Subject: [PATCH] fix(cleanup): detect 503/502 errors as failures and retry --- scripts/cleanup-test-resources.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/cleanup-test-resources.sh b/scripts/cleanup-test-resources.sh index ae38473..201a7c9 100755 --- a/scripts/cleanup-test-resources.sh +++ b/scripts/cleanup-test-resources.sh @@ -80,10 +80,12 @@ parallel_destroy() { # Capture failures by writing failed IDs to a temp file FAIL_FILE=$(mktemp) echo "$IDS" | xargs -P "$PARALLEL_JOBS" -I {} sh -c " - if $UN_CLI $resource_type $destroy_cmd '{}' >/dev/null 2>&1; then + OUTPUT=\$($UN_CLI $resource_type $destroy_cmd '{}' 2>&1) + if [ \$? -eq 0 ] && ! echo \"\$OUTPUT\" | grep -qiE 'HTTP [45][0-9][0-9]|error|unavailable|failed'; then echo 'Destroyed: {}' else echo '{}' >> '$FAIL_FILE' + echo 'Failed: {} -' \$(echo \"\$OUTPUT\" | head -1) fi "