[AMD][CI] setup: Skip redundant pip-cache chown walk and MORI rebuild (#42148)

This commit is contained in:
Eddie Zhou
2026-10-15 16:21:46 +08:00
committed by GitHub
parent 93dbe88183
commit 71a17dbc24
+10 -4
View File
@@ -96,8 +96,10 @@ if [[ "${IMAGE_STAGE_SUFFIX}" == "-rocm724" || "${IMAGE_STAGE_SUFFIX}" == "-rocm
fi
echo "Image torch ${IMAGE_TORCH_VERSION}, HIP ${IMAGE_HIP_VERSION}; installing python extras: [${EXTRAS}]"
# Fix permissions on pip cache, ignore errors from concurrent access or missing temp files
docker exec ci_sglang chown -R root:root /sgl-data/pip-cache 2>/dev/null || true
# Fix permissions on pip cache, ignore errors from concurrent access or missing temp files.
# pip running as root disables the cache unless the cache dir itself is owned by root; it
# never checks the entries beneath it. Simply changing folder permissions reduces chown runtime.
docker exec ci_sglang chown root:root /sgl-data/pip-cache 2>/dev/null || true
docker exec ci_sglang pip install --cache-dir=/sgl-data/pip-cache --upgrade pip
# Helper function to install with retries and fallback PyPI mirror
@@ -229,9 +231,13 @@ fi
# The CI image bakes MORI at the docker/rocm.Dockerfile-pinned commit; when a PR
# bumps MORI_COMMIT the image is not rebuilt, so reinstall MORI here the same way
# the Dockerfile does. Only ENABLE_MORI=1 images ship /sgl-workspace/mori.
if docker exec ci_sglang test -d /sgl-workspace/mori; then
# When the image's checkout is already at the pin the reinstall is redundant.
MORI_COMMIT=$(grep -E '^[[:space:]]*ARG[[:space:]]+MORI_COMMIT=' docker/rocm.Dockerfile | head -n1 | sed 's/.*MORI_COMMIT="\([^"]*\)".*/\1/' || true)
IMAGE_MORI_COMMIT=$(docker exec ci_sglang git -C /sgl-workspace/mori rev-parse HEAD 2>/dev/null || true)
if [[ -n "${MORI_COMMIT}" && "${IMAGE_MORI_COMMIT}" == "${MORI_COMMIT}" ]]; then
echo "[MORI] Image already has MORI ${MORI_COMMIT}; skipping reinstall"
elif docker exec ci_sglang test -d /sgl-workspace/mori; then
MORI_REPO=$(grep -E '^[[:space:]]*ARG[[:space:]]+MORI_REPO=' docker/rocm.Dockerfile | head -n1 | sed 's/.*MORI_REPO="\([^"]*\)".*/\1/')
MORI_COMMIT=$(grep -E '^[[:space:]]*ARG[[:space:]]+MORI_COMMIT=' docker/rocm.Dockerfile | head -n1 | sed 's/.*MORI_COMMIT="\([^"]*\)".*/\1/')
if [[ -z "${MORI_COMMIT}" ]]; then
echo "[MORI] ERROR: Failed to extract MORI_COMMIT from Dockerfile"