From 83c9a547bf9a3b4f2653fb5766886bdc5dba35be Mon Sep 17 00:00:00 2001 From: "Kevin H. Luu" Date: Sun, 18 Oct 2026 00:48:00 -0700 Subject: [PATCH] [CI][Release] Fix release wheel builds: stop excluding tracked recipes/ from Docker context (#62221) Signed-off-by: khluu Co-authored-by: Claude Opus 5.5 Co-authored-by: vllm-agent --- .dockerignore | 2 - .pre-commit-config.yaml | 6 +++ .../pre_commit/check_dockerignore_tracked.py | 48 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 tools/pre_commit/check_dockerignore_tracked.py diff --git a/.dockerignore b/.dockerignore index cdf2c0431a..e0284129ee 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,8 +6,6 @@ dist vllm/*.so vllm/vllm-rs -# Model recipes are rendered by vllm-project/recipes, never part of the image. -/recipes # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 78a672c110..d1715b15c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -277,6 +277,12 @@ repos: files: ^docker/(Dockerfile|versions\.json)$ pass_filenames: false additional_dependencies: [dockerfile-parse] + - id: check-dockerignore-tracked + name: Check .dockerignore does not exclude tracked files + entry: python tools/pre_commit/check_dockerignore_tracked.py + language: python + always_run: true + pass_filenames: false - id: check-boolean-context-manager name: Check for boolean ops in with-statements entry: python tools/pre_commit/check_boolean_context_manager.py diff --git a/tools/pre_commit/check_dockerignore_tracked.py b/tools/pre_commit/check_dockerignore_tracked.py new file mode 100644 index 0000000000..9aeae9c88e --- /dev/null +++ b/tools/pre_commit/check_dockerignore_tracked.py @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project +"""Check that no root-anchored `.dockerignore` entry excludes tracked files. + +Docker builds bind-mount `.git` but copy the working tree through the build +context, so git sees any tracked file that `.dockerignore` drops as deleted. +That dirty tree fails `tools/check_repo.sh` in release builds +(`GIT_REPO_CHECK=1`) and adds a `.dYYYYMMDD` dirty suffix to the wheel version. + +Usage: + python tools/pre_commit/check_dockerignore_tracked.py +""" + +import subprocess +import sys +from pathlib import Path + +DOCKERIGNORE = Path(".dockerignore") + + +def main() -> int: + rooted = [ + line.strip().strip("/") + for line in DOCKERIGNORE.read_text(encoding="utf-8").splitlines() + if line.startswith("/") + ] + if not rooted: + return 0 + tracked = subprocess.run( + ["git", "ls-files", "--", *rooted], + check=True, + stdout=subprocess.PIPE, + text=True, + ).stdout.split() + if not tracked: + return 0 + print( + f"{DOCKERIGNORE} excludes {len(tracked)} tracked file(s). Docker builds " + "would see them as deleted and the git tree as dirty, failing " + "tools/check_repo.sh in release builds. First few:" + ) + for path in tracked[:10]: + print(f" {path}") + return 1 + + +if __name__ == "__main__": + sys.exit(main())