From 8e6b9684fb53896a72a95efb691192a2943d39b1 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 28 Apr 2026 22:26:02 +0200 Subject: [PATCH] fix(argo): TEST_BIN path must honour CARGO_TARGET_DIR not repo-relative target/ The workflow sets CARGO_TARGET_DIR=/cargo-target so cargo writes binaries to /cargo-target/release/deps/ml-*, not target/release/deps/ml-*. Both templates were globbing the wrong path and failed with exit 3 (now caught by the explicit error message). Compile finished cleanly in 4m14s (sccache cache hit on first run after re-checkout); test binary lookup then failed and the script exited at the 'could not locate compiled test binary' check. --- infra/k8s/argo/nsys-test-template.yaml | 9 ++++++--- infra/k8s/argo/sanitizer-test-template.yaml | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/infra/k8s/argo/nsys-test-template.yaml b/infra/k8s/argo/nsys-test-template.yaml index 4862bc78f..b5be4bc9b 100644 --- a/infra/k8s/argo/nsys-test-template.yaml +++ b/infra/k8s/argo/nsys-test-template.yaml @@ -213,12 +213,15 @@ spec: cargo test -p ml --release --lib --no-run 2>&1 | tee /cargo-target/nsys-compile.log cargo build -p ml --release --example train_baseline_rl 2>&1 | tee -a /cargo-target/nsys-compile.log - TEST_BIN=$(ls -t target/release/deps/ml-* 2>/dev/null \ + # Honour CARGO_TARGET_DIR — outputs go to ${CARGO_TARGET_DIR}/release/deps, + # NOT the repo-relative target/. (CI workflow sets CARGO_TARGET_DIR=/cargo-target.) + TARGET_DIR="${CARGO_TARGET_DIR:-target}" + TEST_BIN=$(ls -t "$TARGET_DIR/release/deps/ml-"* 2>/dev/null \ | grep -vE '\.(d|rcgu|rmeta|rlib|so|json)$' \ | head -1) if [ -z "$TEST_BIN" ] || [ ! -x "$TEST_BIN" ]; then - echo "ERROR: could not locate compiled test binary" - ls -la target/release/deps/ | head -20 + echo "ERROR: could not locate compiled test binary in $TARGET_DIR/release/deps/" + ls -la "$TARGET_DIR/release/deps/" 2>&1 | head -20 exit 3 fi echo "=== Test binary: $TEST_BIN ===" diff --git a/infra/k8s/argo/sanitizer-test-template.yaml b/infra/k8s/argo/sanitizer-test-template.yaml index 252b730b3..7bbf6dfcc 100644 --- a/infra/k8s/argo/sanitizer-test-template.yaml +++ b/infra/k8s/argo/sanitizer-test-template.yaml @@ -201,12 +201,15 @@ spec: cargo build -p ml --release --example train_baseline_rl 2>&1 | tee -a /cargo-target/sanitizer-compile.log # Locate the freshest ml-* test binary - TEST_BIN=$(ls -t target/release/deps/ml-* 2>/dev/null \ + # Honour CARGO_TARGET_DIR — outputs go to ${CARGO_TARGET_DIR}/release/deps, + # NOT the repo-relative target/. (CI workflow sets CARGO_TARGET_DIR=/cargo-target.) + TARGET_DIR="${CARGO_TARGET_DIR:-target}" + TEST_BIN=$(ls -t "$TARGET_DIR/release/deps/ml-"* 2>/dev/null \ | grep -vE '\.(d|rcgu|rmeta|rlib|so|json)$' \ | head -1) if [ -z "$TEST_BIN" ] || [ ! -x "$TEST_BIN" ]; then - echo "ERROR: could not locate compiled test binary in target/release/deps/" - ls -la target/release/deps/ | head -20 + echo "ERROR: could not locate compiled test binary in $TARGET_DIR/release/deps/" + ls -la "$TARGET_DIR/release/deps/" 2>&1 | head -20 exit 3 fi echo "=== Test binary: $TEST_BIN ==="