From d999dfd385e1ad5d2d8e4d9a518ffdedd0767058 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 28 Apr 2026 22:36:49 +0200 Subject: [PATCH] fix(argo): replace grep -q | TEST_BIN--list pipe with capture-then-grep to avoid SIGPIPE `grep -q` exits early on first match, closing stdin to upstream `$TEST_BIN --list`. With pipefail enabled, that SIGPIPE on the upstream process bubbles up as exit 141 and kills the workflow before the sanitizer/nsys can launch. Capture --list output once into a variable, then grep the captured string (which doesn't pipe to a process). Same pattern for the already-broken-but-defensive head -30 in the error branch. --- infra/k8s/argo/nsys-test-template.yaml | 7 +++++-- infra/k8s/argo/sanitizer-test-template.yaml | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/infra/k8s/argo/nsys-test-template.yaml b/infra/k8s/argo/nsys-test-template.yaml index 76c383383..174845395 100644 --- a/infra/k8s/argo/nsys-test-template.yaml +++ b/infra/k8s/argo/nsys-test-template.yaml @@ -233,9 +233,12 @@ spec: fi echo "=== Test binary: $TEST_BIN ===" - if ! "$TEST_BIN" --list 2>&1 | grep -q "$TEST_NAME"; then + # grep -q + pipefail = SIGPIPE on early exit. Capture once, grep + # without -q so the consumer reads all input. + TEST_LIST=$("$TEST_BIN" --list 2>&1 || true) + if ! echo "$TEST_LIST" | grep -F "$TEST_NAME" > /dev/null; then echo "ERROR: test '$TEST_NAME' not found" - "$TEST_BIN" --list 2>&1 | grep smoke_tests | head -30 + echo "$TEST_LIST" | grep smoke_tests | (head -30 || true) exit 4 fi diff --git a/infra/k8s/argo/sanitizer-test-template.yaml b/infra/k8s/argo/sanitizer-test-template.yaml index 2bdbd8ae2..c18de164d 100644 --- a/infra/k8s/argo/sanitizer-test-template.yaml +++ b/infra/k8s/argo/sanitizer-test-template.yaml @@ -222,10 +222,13 @@ spec: echo "=== Test binary: $TEST_BIN ===" # --- Verify the test exists in the binary --- - if ! "$TEST_BIN" --list 2>&1 | grep -q "$TEST_NAME"; then + # grep -q + pipefail = SIGPIPE on early exit. Capture once, grep + # without -q so the consumer reads all input. Same below for nsys. + TEST_LIST=$("$TEST_BIN" --list 2>&1 || true) + if ! echo "$TEST_LIST" | grep -F "$TEST_NAME" > /dev/null; then echo "ERROR: test '$TEST_NAME' not found in binary." echo "Available smoke tests:" - "$TEST_BIN" --list 2>&1 | grep smoke_tests | head -30 + echo "$TEST_LIST" | grep smoke_tests | (head -30 || true) exit 4 fi