From 03f03f9630396da9c7d6675589127ade4a8f283f Mon Sep 17 00:00:00 2001 From: Michael Goin Date: Thu, 28 May 2026 17:20:12 -0400 Subject: [PATCH] Refactor output filename handling in ci-fetch-log.sh (#43901) Signed-off-by: Michael Goin --- .buildkite/scripts/ci-fetch-log.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/ci-fetch-log.sh b/.buildkite/scripts/ci-fetch-log.sh index 02798b56f4a..3f99bc50a57 100755 --- a/.buildkite/scripts/ci-fetch-log.sh +++ b/.buildkite/scripts/ci-fetch-log.sh @@ -9,6 +9,13 @@ # Find and via: # gh pr checks --repo vllm-project/vllm # Each failing row's URL is .../builds/#. +# +# Default output path: ci--.log (e.g. +# ci-68478-019e6b07-daae.log). Jobs in the same build share the UUID's +# first 8 chars, so the second segment is needed for uniqueness when +# fetching multiple jobs in parallel. The script refuses to overwrite an +# existing output file; pass an explicit path or set CI_FETCH_LOG_FORCE=1 +# to override. set -euo pipefail @@ -26,12 +33,12 @@ if [ $# -lt 1 ]; then usage; fi if [[ "$1" == https://* ]]; then BUILD=$(echo "$1" | sed -nE 's#.*/builds/([0-9]+).*#\1#p') JOB=$(echo "$1" | grep -oE '[0-9a-f]{8}-[0-9a-f-]+' | head -n 1) - OUT="${2:-ci-${BUILD}-${JOB:0:8}.log}" + OUT="${2:-}" else if [ $# -lt 2 ]; then usage; fi BUILD="$1" JOB="$2" - OUT="${3:-ci-${BUILD}-${JOB:0:8}.log}" + OUT="${3:-}" fi if [ -z "$BUILD" ] || [ -z "$JOB" ]; then @@ -39,6 +46,18 @@ if [ -z "$BUILD" ] || [ -z "$JOB" ]; then usage fi +# Jobs in the same build share the UUID's first segment, so include the +# second segment (chars 9-13, e.g. "019e6b07-daae") to keep default filenames +# unique when fetching multiple jobs from one build in parallel. +if [ -z "$OUT" ]; then + OUT="ci-${BUILD}-${JOB:0:13}.log" +fi + +if [ -e "$OUT" ] && [ -z "${CI_FETCH_LOG_FORCE:-}" ]; then + echo "Refusing to overwrite existing $OUT (set CI_FETCH_LOG_FORCE=1 or pass an explicit output path)." >&2 + exit 1 +fi + COOKIES=$(mktemp) trap 'rm -f "$COOKIES"' EXIT