Skip to content

Commit 1109f98

Browse files
authored
[CI] fix docker image build by specifying merge-base commit id when downloading pre-compiled wheels (#29930)
Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
1 parent b540786 commit 1109f98

File tree

5 files changed

+22
-64
lines changed

5 files changed

+22
-64
lines changed

.buildkite/generate_index.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

docker/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ ARG SCCACHE_S3_NO_CREDENTIALS=0
196196

197197
# Flag to control whether to use pre-built vLLM wheels
198198
ARG VLLM_USE_PRECOMPILED=""
199+
ARG VLLM_MERGE_BASE_COMMIT=""
199200
ARG VLLM_MAIN_CUDA_VERSION=""
200201

201202
# Use dummy version for csrc-build wheel (only .so files are extracted, version doesn't matter)
@@ -216,6 +217,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
216217
&& export SCCACHE_IDLE_TIMEOUT=0 \
217218
&& export CMAKE_BUILD_TYPE=Release \
218219
&& export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" \
220+
&& export VLLM_PRECOMPILED_WHEEL_COMMIT="${VLLM_MERGE_BASE_COMMIT}" \
219221
&& export VLLM_MAIN_CUDA_VERSION="${VLLM_MAIN_CUDA_VERSION}" \
220222
&& export VLLM_DOCKER_BUILD_CONTEXT=1 \
221223
&& sccache --show-stats \
@@ -233,6 +235,7 @@ RUN --mount=type=cache,target=/root/.cache/ccache \
233235
rm -rf .deps && \
234236
mkdir -p .deps && \
235237
export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" && \
238+
export VLLM_PRECOMPILED_WHEEL_COMMIT="${VLLM_MERGE_BASE_COMMIT}" && \
236239
export VLLM_DOCKER_BUILD_CONTEXT=1 && \
237240
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
238241
fi

setup.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,13 @@ def determine_wheel_url() -> tuple[str, str | None]:
346346
The order of preference is:
347347
1. user-specified wheel location (can be either local or remote, via
348348
VLLM_PRECOMPILED_WHEEL_LOCATION)
349-
2. user-specified variant from nightly repo (current main commit via
350-
VLLM_PRECOMPILED_WHEEL_VARIANT)
349+
2. user-specified variant (VLLM_PRECOMPILED_WHEEL_VARIANT) from nightly repo
351350
3. the variant corresponding to VLLM_MAIN_CUDA_VERSION from nightly repo
352-
4. the default variant from nightly repo (current main commit)
351+
4. the default variant from nightly repo
352+
353+
If downloading from the nightly repo, the commit can be specified via
354+
VLLM_PRECOMPILED_WHEEL_COMMIT; otherwise, the head commit in the main branch
355+
is used.
353356
"""
354357
wheel_location = os.getenv("VLLM_PRECOMPILED_WHEEL_LOCATION", None)
355358
if wheel_location is not None:
@@ -362,10 +365,13 @@ def determine_wheel_url() -> tuple[str, str | None]:
362365
# try to fetch the wheel metadata from the nightly wheel repo
363366
main_variant = "cu" + envs.VLLM_MAIN_CUDA_VERSION.replace(".", "")
364367
variant = os.getenv("VLLM_PRECOMPILED_WHEEL_VARIANT", main_variant)
365-
commit = os.getenv(
366-
"VLLM_PRECOMPILED_WHEEL_COMMIT",
367-
precompiled_wheel_utils.get_base_commit_in_main_branch(),
368-
)
368+
commit = os.getenv("VLLM_PRECOMPILED_WHEEL_COMMIT", "").lower()
369+
if not commit or len(commit) != 40:
370+
print(
371+
f"VLLM_PRECOMPILED_WHEEL_COMMIT not valid: {commit}"
372+
", trying to fetch base commit in main branch"
373+
)
374+
commit = precompiled_wheel_utils.get_base_commit_in_main_branch()
369375
print(f"Using precompiled wheel commit {commit} with variant {variant}")
370376
try_default = False
371377
wheels, repo_url, download_filename = None, None, None
@@ -502,10 +508,6 @@ def extract_precompiled_and_patch_package(
502508

503509
@staticmethod
504510
def get_base_commit_in_main_branch() -> str:
505-
# Force to use the nightly wheel. This is mainly used for CI testing.
506-
if envs.VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL:
507-
return "nightly"
508-
509511
try:
510512
# Get the latest commit hash of the upstream main branch.
511513
resp_json = subprocess.check_output(
@@ -516,6 +518,7 @@ def get_base_commit_in_main_branch() -> str:
516518
]
517519
).decode("utf-8")
518520
upstream_main_commit = json.loads(resp_json)["sha"]
521+
print(f"Upstream main branch latest commit: {upstream_main_commit}")
519522

520523
# In Docker build context, .git may be immutable or missing.
521524
if envs.VLLM_DOCKER_BUILD_CONTEXT:

tests/standalone_tests/python_only_compile.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
set -e
66
set -x
77

8+
merge_base_commit=$(git merge-base HEAD origin/main)
9+
echo "Current merge base commit with main: $merge_base_commit"
10+
git show --oneline -s $merge_base_commit
11+
812
cd /vllm-workspace/
913

1014
# uninstall vllm
@@ -18,7 +22,7 @@ apt autoremove -y
1822

1923
echo 'import os; os.system("touch /tmp/changed.file")' >> vllm/__init__.py
2024

21-
VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL=1 VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e .
25+
VLLM_PRECOMPILED_WHEEL_COMMIT=$merge_base_commit VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e .
2226

2327
# Run the script
2428
python3 -c 'import vllm'

vllm/envs.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
VLLM_USE_PRECOMPILED: bool = False
8181
VLLM_SKIP_PRECOMPILED_VERSION_SUFFIX: bool = False
8282
VLLM_DOCKER_BUILD_CONTEXT: bool = False
83-
VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL: bool = False
8483
VLLM_KEEP_ALIVE_ON_ENGINE_DEATH: bool = False
8584
CMAKE_BUILD_TYPE: Literal["Debug", "Release", "RelWithDebInfo"] | None = None
8685
VERBOSE: bool = False
@@ -473,11 +472,6 @@ def get_vllm_port() -> int | None:
473472
.strip()
474473
.lower()
475474
in ("1", "true"),
476-
# Whether to force using nightly wheel in python build.
477-
# This is used for testing the nightly wheel in python build.
478-
"VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL": lambda: bool(
479-
int(os.getenv("VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL", "0"))
480-
),
481475
# CMake build type
482476
# If not set, defaults to "Debug" or "RelWithDebInfo"
483477
# Available options: "Debug", "Release", "RelWithDebInfo"

0 commit comments

Comments
 (0)