From 12e582922145bc7441e2f20e451dd161d4ffe828 Mon Sep 17 00:00:00 2001 From: Reid <61492567+reidliu41@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:26:12 +0800 Subject: [PATCH] [doc] improve ci doc (#19307) Signed-off-by: reidliu41 Co-authored-by: reidliu41 --- .buildkite/scripts/ci-clean-log.sh | 17 +++++++++++++++++ .buildkite/scripts/rerun-test.sh | 18 ++++++++++++++++++ docs/contributing/ci-failures.md | 16 +++++++--------- 3 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 .buildkite/scripts/ci-clean-log.sh create mode 100644 .buildkite/scripts/rerun-test.sh diff --git a/.buildkite/scripts/ci-clean-log.sh b/.buildkite/scripts/ci-clean-log.sh new file mode 100644 index 000000000..69d8a3a28 --- /dev/null +++ b/.buildkite/scripts/ci-clean-log.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Usage: ./ci_clean_log.sh ci.log +# This script strips timestamps and color codes from CI log files. + +# Check if argument is given +if [ $# -lt 1 ]; then + echo "Usage: $0 ci.log" + exit 1 +fi + +INPUT_FILE="$1" + +# Strip timestamps +sed -i 's/^\[[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z\] //' "$INPUT_FILE" + +# Strip colorization +sed -i -r 's/\x1B\[[0-9;]*[mK]//g' "$INPUT_FILE" diff --git a/.buildkite/scripts/rerun-test.sh b/.buildkite/scripts/rerun-test.sh new file mode 100644 index 000000000..d79c0d5f3 --- /dev/null +++ b/.buildkite/scripts/rerun-test.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Usage: ./rerun_test.sh path/to/test.py::test_name + +# Check if argument is given +if [ $# -lt 1 ]; then + echo "Usage: $0 path/to/test.py::test_name" + echo "Example: $0 tests/v1/engine/test_engine_core_client.py::test_kv_cache_events[True-tcp]" + exit 1 +fi + +TEST=$1 +COUNT=1 + +while pytest -sv "$TEST"; do + COUNT=$((COUNT + 1)) + echo "RUN NUMBER ${COUNT}" +done diff --git a/docs/contributing/ci-failures.md b/docs/contributing/ci-failures.md index 4d8f78197..7caaf10ce 100644 --- a/docs/contributing/ci-failures.md +++ b/docs/contributing/ci-failures.md @@ -64,15 +64,13 @@ Download the full log file from Buildkite locally. Strip timestamps and colorization: -```bash -# Strip timestamps -sed -i 's/^\[[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z\] //' ci.log + -# Strip colorization -sed -i -r 's/\x1B\[[0-9;]*[mK]//g' ci.log +```bash +./ci-clean-log.sh ci.log ``` -Use a tool for quick copy-pasting: +Use a tool [wl-clipboard](https://github.com/bugaevc/wl-clipboard) for quick copy-pasting: ```bash tail -525 ci_build.log | wl-copy @@ -89,10 +87,10 @@ tail -525 ci_build.log | wl-copy CI test failures may be flaky. Use a bash loop to run repeatedly: + + ```bash -COUNT=1; while pytest -sv tests/v1/engine/test_engine_core_client.py::test_kv_cache_events[True-tcp]; do - COUNT=$[$COUNT + 1]; echo "RUN NUMBER ${COUNT}"; -done +./rerun-test.sh tests/v1/engine/test_engine_core_client.py::test_kv_cache_events[True-tcp] ``` ## Submitting a PR