From 5effab7b0f45a484d66714c140264fce2b8d233e Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Fri, 28 Aug 2026 08:28:57 -0500 Subject: [PATCH 1/2] Fix cuopt_mvn retry loop being skipped under set -e (#1820) cuopt_mvn's retry loop ran `mvn ... | tee "${log}"` as a bare statement. Callers (java/cuopt/scripts/test.sh) run under `set -euo pipefail`, so a failing pipeline there aborted the function immediately, before the retry logic that inspects PIPESTATUS ever ran. A Maven Central 429 hit would fail on the very first attempt with none of the retry/backoff behavior actually taking effect, as seen in job 98796785653 (PR #1810). Guard the pipeline as the condition of an if so its failure is caught by the retry loop instead of triggering the caller's set -e. Co-Authored-By: Claude Sonnet 5 --- java/cuopt/scripts/maven.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/java/cuopt/scripts/maven.sh b/java/cuopt/scripts/maven.sh index 5d034a0eb3..0cca7664b3 100755 --- a/java/cuopt/scripts/maven.sh +++ b/java/cuopt/scripts/maven.sh @@ -30,9 +30,14 @@ cuopt_mvn() { log="$(mktemp)" while true; do - # tee would otherwise report its own exit status rather than Maven's. - mvn "${CUOPT_MVN_ARGS[@]}" "$@" 2>&1 | tee "${log}" - status="${PIPESTATUS[0]}" + # The pipeline is the condition of this if, not a bare statement, so its failure does not + # trigger the caller's 'set -e' before the retry logic below gets to see it. tee would + # otherwise report its own exit status rather than Maven's, hence PIPESTATUS. + if mvn "${CUOPT_MVN_ARGS[@]}" "$@" 2>&1 | tee "${log}"; then + status=0 + else + status="${PIPESTATUS[0]}" + fi if [[ "${status}" -eq 0 ]]; then rm -f "${log}" return 0 From 6ab04ab11ac502bb58149a2079daa65a1ed40d43 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Fri, 28 Aug 2026 08:34:45 -0500 Subject: [PATCH 2/2] Trim comment on the set -e guard Co-Authored-By: Claude Sonnet 5 --- java/cuopt/scripts/maven.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/cuopt/scripts/maven.sh b/java/cuopt/scripts/maven.sh index 0cca7664b3..9451a1a20f 100755 --- a/java/cuopt/scripts/maven.sh +++ b/java/cuopt/scripts/maven.sh @@ -30,9 +30,7 @@ cuopt_mvn() { log="$(mktemp)" while true; do - # The pipeline is the condition of this if, not a bare statement, so its failure does not - # trigger the caller's 'set -e' before the retry logic below gets to see it. tee would - # otherwise report its own exit status rather than Maven's, hence PIPESTATUS. + # Guarded by if so a failure doesn't trigger the caller's set -e before we see PIPESTATUS. if mvn "${CUOPT_MVN_ARGS[@]}" "$@" 2>&1 | tee "${log}"; then status=0 else