From 6110ed671f337b290bb90e0c3f3de6ef224d7035 Mon Sep 17 00:00:00 2001 From: ashwini rathi Date: Wed, 10 Jun 2026 07:16:54 +0530 Subject: [PATCH] ci(xpu): clean build artifacts in cleanup (#27648) Co-authored-by: Patil, Jitendra Co-authored-by: Claude Opus 4.7 (1M context) --- .github/workflows/pr-test-xpu.yml | 20 ++++++++++++++++++-- scripts/ci/xpu/xpu_ci_start_container.sh | 15 +++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-test-xpu.yml b/.github/workflows/pr-test-xpu.yml index 2f5ca1e5e..86d8da893 100644 --- a/.github/workflows/pr-test-xpu.yml +++ b/.github/workflows/pr-test-xpu.yml @@ -118,7 +118,15 @@ jobs: - name: Cleanup container if: always() - run: docker rm -f ci_sglang_xpu || true + run: | + rm -rf \ + python/build \ + python/sglang.egg-info \ + test/result.jsonl || true + docker rm -f ci_sglang_xpu || true + if [[ -n "${CI_SGLANG_XPU_IMAGE:-}" ]]; then + docker rmi -f "${CI_SGLANG_XPU_IMAGE}" || true + fi # ==================== Wait for Stage A ==================== # wait-for-stage-a: @@ -173,7 +181,15 @@ jobs: - name: Cleanup container if: always() - run: docker rm -f ci_sglang_xpu || true + run: | + rm -rf \ + python/build \ + python/sglang.egg-info \ + test/result.jsonl || true + docker rm -f ci_sglang_xpu || true + if [[ -n "${CI_SGLANG_XPU_IMAGE:-}" ]]; then + docker rmi -f "${CI_SGLANG_XPU_IMAGE}" || true + fi finish: if: always() diff --git a/scripts/ci/xpu/xpu_ci_start_container.sh b/scripts/ci/xpu/xpu_ci_start_container.sh index 0847168b0..662165c10 100755 --- a/scripts/ci/xpu/xpu_ci_start_container.sh +++ b/scripts/ci/xpu/xpu_ci_start_container.sh @@ -114,14 +114,17 @@ find_latest_image() { if [[ -n "${CUSTOM_IMAGE}" ]]; then IMAGE="${CUSTOM_IMAGE}" echo "Using custom image: ${IMAGE}" - retry_with_backoff 6 docker pull "${IMAGE}" else IMAGE=$(find_latest_image) - if ! docker image inspect "${IMAGE}" >/dev/null 2>&1; then - retry_with_backoff 6 docker pull "${IMAGE}" - else - echo "Image ${IMAGE} already present locally; skipping pull" - fi +fi +# Always pull so each stage runs the registry's current image; the cleanup +# step removes the image after the stage so the runner doesn't accumulate +# stale layers across runs. +retry_with_backoff 6 docker pull "${IMAGE}" + +# Export the resolved image so the cleanup step can rmi the exact tag used. +if [[ -n "${GITHUB_ENV:-}" ]]; then + echo "CI_SGLANG_XPU_IMAGE=${IMAGE}" >> "${GITHUB_ENV}" fi # Remove any stale container of the same name so re-runs are idempotent.