Skip to content

Commit 49441d0

Browse files
authored
chore: Move vllm specific build artifacts and add precommit hooks (#5485)
* move vllm specific build artifacts and add precommit hooks Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * docker fmt Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * run all precommits Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> * fix indentations Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com> --------- Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com>
1 parent 3e82f3c commit 49441d0

File tree

10 files changed

+245
-154
lines changed

10 files changed

+245
-154
lines changed

.github/workflows/pr-vllm.yml

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

.markdownlint.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"MD013": false, // disable line-length limit
3-
"MD033": false, // allow inline HTML
4-
"MD041": false // allow first line not being top level
2+
"MD013": false,
3+
"MD033": false,
4+
"MD041": false
55
}

.pre-commit-config.yaml

Lines changed: 136 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,64 +7,154 @@ default_stages:
77
- manual
88

99
repos:
10-
- repo: https://github.com/reteps/dockerfmt
11-
rev: v0.3.9
10+
# ---------------------------------------------------------------------------- #
11+
# 🔄 Pre-Commit Hooks #
12+
# ---------------------------------------------------------------------------- #
13+
14+
### Pre-commit First-Party Tools
15+
- repo: https://github.com/pre-commit/pre-commit-hooks
16+
rev: v6.0.0
1217
hooks:
13-
- id: dockerfmt
14-
args:
15-
# optional: add additional arguments here
16-
- --indent=2
17-
- --write
18-
stages: [pre-commit]
19-
- repo: https://github.com/scop/pre-commit-shfmt
20-
rev: v3.12.0-2 # Use the latest stable revision
18+
# ------------------------------- 🌳 Git Tools ------------------------------- #
19+
- id: check-merge-conflict
20+
name: "🌳 git · Detect conflict markers"
21+
- id: forbid-new-submodules
22+
name: "🌳 git · Prevent submodule creation"
23+
- id: no-commit-to-branch
24+
name: "🌳 git · Protect main branches"
25+
args: ["--branch", "main", "--branch", "master"]
26+
- id: check-added-large-files
27+
name: "🌳 git · Block large file commits"
28+
args: ["--maxkb=5000"]
29+
# ---------------------------- 📁 Filesystem Tools --------------------------- #
30+
- id: check-executables-have-shebangs
31+
name: "📁 filesystem/⚙️ exec · Verify shebang presence"
32+
- id: check-shebang-scripts-are-executable
33+
name: "📁 filesystem/⚙️ exec · Verify script permissions"
34+
- id: check-symlinks
35+
name: "📁 filesystem/🔗 symlink · Check symlink validity"
36+
- id: destroyed-symlinks
37+
name: "📁 filesystem/🔗 symlink · Detect broken symlinks"
38+
- id: requirements-txt-fixer
39+
name: "📁 filesystem/📝 file · Validate requirements.txt"
40+
- id: trailing-whitespace
41+
name: "📁 filesystem/📝 file · Validate empty whitespaces"
42+
# ----------------------------- 🔒 Security Tools ---------------------------- #
43+
- id: check-json
44+
name: "📁 filesystem/🔧 config · Validate JSON file"
45+
- id: check-yaml
46+
name: "📁 filesystem/🔧 config · Validate YAML file"
47+
- id: detect-aws-credentials
48+
name: "🔒 security · Detect aws credentials"
49+
args:
50+
- --allow-missing-credentials
51+
- id: detect-private-key
52+
name: "🔒 security · Detect private kayes"
53+
54+
55+
- repo: https://github.com/gitleaks/gitleaks
56+
rev: v8.29.0
57+
hooks:
58+
- id: gitleaks
59+
name: "🔒 security · Detect hardcoded secrets"
60+
61+
# --------------------------- 🔍 Code Quality Tools -------------------------- #
62+
63+
### Writing Tools ###
64+
- repo: https://github.com/crate-ci/typos
65+
rev: v1.38.1
66+
hooks:
67+
- id: typos
68+
name: "✏️ typos · Checking typos"
69+
args: [--force-exclude]
70+
71+
72+
### Python Tools ###
73+
- repo: https://github.com/astral-sh/ruff-pre-commit
74+
rev: v0.14.3
2175
hooks:
22-
- id: shfmt
23-
# Optional: Add arguments to shfmt if needed, e.g., to enable "simplify" mode
24-
args: ["-s"]
25-
stages: [pre-commit]
76+
- id: ruff-format
77+
name: "🐍 python · Format python"
78+
- id: ruff-check
79+
name: "🐍 python · Lint python"
80+
81+
82+
### Workflow Validation ###
83+
- repo: https://github.com/python-jsonschema/check-jsonschema
84+
rev: 0.35.0
85+
hooks:
86+
- id: check-github-workflows
87+
name: "🐙 github-actions · Validate gh workflow files"
88+
args: ["--verbose"]
89+
90+
- repo: https://github.com/rhysd/actionlint
91+
rev: v1.7.8
92+
hooks:
93+
- id: actionlint
94+
name: "🐙 github-actions · Lint gh workflow files"
95+
args: ["-shellcheck=enable=all"]
96+
97+
98+
### Markdown ###
2699
- repo: https://github.com/hukkin/mdformat
27-
rev: 1.0.0 # Use the ref you want to point at
100+
rev: 1.0.0
28101
hooks:
29102
- id: mdformat
30-
# Optionally add plugins
103+
name: "📝 markdown · Format markdown"
31104
additional_dependencies:
32105
- mdformat-gfm
33-
- mdformat-black
34-
stages: [pre-commit]
106+
- mdformat-ruff
107+
- ruff
108+
35109
- repo: https://github.com/igorshubovych/markdownlint-cli
36110
rev: v0.45.0
37111
hooks:
38-
- id: markdownlint
39-
args: [--fix]
40-
stages: [pre-commit]
41-
- repo: https://github.com/astral-sh/ruff-pre-commit
42-
rev: v0.14.3
112+
- id: markdownlint
113+
name: "📝 markdown · Lint markdown"
114+
args: [--fix]
115+
116+
117+
### Docker Tools ###
118+
- repo: https://github.com/reteps/dockerfmt
119+
rev: v0.3.9
43120
hooks:
44-
- id: ruff-format
45-
stages: [pre-commit]
46-
- id: ruff-check
47-
- repo: https://github.com/rhysd/actionlint
48-
rev: v1.7.7
121+
- id: dockerfmt
122+
name: "🐳 docker · Format docker"
123+
args:
124+
- --indent=2
125+
- --write
126+
127+
128+
### Shell ###
129+
- repo: https://github.com/scop/pre-commit-shfmt
130+
rev: v3.12.0-2 # Use the latest stable revision
49131
hooks:
50-
- id: actionlint
51-
args: ["-shellcheck=enable=all"]
52-
- repo: https://github.com/crate-ci/typos
53-
rev: v1.38.1
132+
- id: shfmt
133+
name: "🐚 shell · Format shell scripts"
134+
args: ["-s"]
135+
136+
137+
# --------------------------- ✍️ Git Commit Quality -------------------------- #
138+
139+
### Commit Message Standards ###
140+
- repo: https://github.com/commitizen-tools/commitizen
141+
rev: v4.1.0
54142
hooks:
55-
- id: typos
56-
args: [--force-exclude]
143+
- id: commitizen
144+
name: "🌳 git · Validate commit message"
145+
additional_dependencies: [cz-conventional-gitmoji]
146+
57147
- repo: local
58148
hooks:
59-
- id: signoff-commit
60-
name: Sign-off Commit
61-
entry: bash
62-
args:
63-
- -c
64-
- |
65-
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
66-
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
67-
fi
68-
language: system
69-
verbose: true
70-
stages: [commit-msg]
149+
- id: signoff-commit
150+
name: Sign-off Commit
151+
entry: bash
152+
args:
153+
- -c
154+
- |
155+
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
156+
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
157+
fi
158+
language: system
159+
verbose: true
160+
stages: [commit-msg]

docker/vllm/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ WORKDIR /
1919

2020
COPY ./scripts/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
2121
COPY ./scripts/telemetry/bash_telemetry.sh /usr/local/bin/bash_telemetry.sh
22-
COPY ./scripts/setup_oss_compliance.sh setup_oss_compliance.sh
22+
COPY ./scripts/common/setup_oss_compliance.sh setup_oss_compliance.sh
2323

2424
RUN chmod +x /usr/local/bin/deep_learning_container.py \
2525
&& chmod +x /usr/local/bin/bash_telemetry.sh \
@@ -34,7 +34,7 @@ RUN chmod +x /usr/local/bin/deep_learning_container.py \
3434
&& rm -rf /var/lib/apt/lists/* \
3535
&& rm -rf /root/.cache | true
3636

37-
COPY ./scripts/install_efa.sh install_efa.sh
37+
COPY ./scripts/common/install_efa.sh install_efa.sh
3838
RUN bash install_efa.sh ${EFA_VERSION} \
3939
&& rm install_efa.sh \
4040
&& mkdir -p /tmp/nvjpeg \
@@ -59,7 +59,7 @@ RUN dpkg -l | grep -E "cuda|nvidia|libnv" | awk '{print $2}' | xargs apt-mark ho
5959
&& apt-get upgrade -y \
6060
&& apt-get clean
6161

62-
COPY ./scripts/dockerd_entrypoint.sh /usr/local/bin/dockerd_entrypoint.sh
62+
COPY ./scripts/vllm/dockerd_entrypoint.sh /usr/local/bin/dockerd_entrypoint.sh
6363
RUN chmod +x /usr/local/bin/dockerd_entrypoint.sh
6464

6565
ENTRYPOINT ["/usr/local/bin/dockerd_entrypoint.sh"]

docker/vllm/Dockerfile.rayserve

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ WORKDIR /
1919

2020
COPY ./scripts/telemetry/deep_learning_container.py /usr/local/bin/deep_learning_container.py
2121
COPY ./scripts/telemetry/bash_telemetry.sh /usr/local/bin/bash_telemetry.sh
22-
COPY ./scripts/setup_oss_compliance.sh setup_oss_compliance.sh
22+
COPY ./scripts/common/setup_oss_compliance.sh setup_oss_compliance.sh
2323

2424
RUN chmod +x /usr/local/bin/deep_learning_container.py \
2525
&& chmod +x /usr/local/bin/bash_telemetry.sh \
@@ -34,7 +34,7 @@ RUN chmod +x /usr/local/bin/deep_learning_container.py \
3434
&& rm -rf /var/lib/apt/lists/* \
3535
&& rm -rf /root/.cache | true
3636

37-
COPY ./scripts/install_efa.sh install_efa.sh
37+
COPY ./scripts/common/install_efa.sh install_efa.sh
3838
RUN bash install_efa.sh ${EFA_VERSION} \
3939
&& rm install_efa.sh \
4040
&& mkdir -p /tmp/nvjpeg \
@@ -62,7 +62,7 @@ RUN dpkg -l | grep -E "cuda|nvidia|libnv" | awk '{print $2}' | xargs apt-mark ho
6262
&& apt-get upgrade -y \
6363
&& apt-get clean
6464

65-
COPY ./scripts/dockerd_entrypoint.sh /usr/local/bin/dockerd_entrypoint.sh
65+
COPY ./scripts/vllm/dockerd_entrypoint.sh /usr/local/bin/dockerd_entrypoint.sh
6666
RUN chmod +x /usr/local/bin/dockerd_entrypoint.sh
6767

6868
ENTRYPOINT ["/usr/local/bin/dockerd_entrypoint.sh"]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function check_libnccl_net_so {
3030
function install_efa {
3131
EFA_VERSION=$1
3232
OPEN_MPI_PATH="/opt/amazon/openmpi"
33-
33+
3434
# Install build time tools
3535
apt-get update
3636
apt-get install -y --allow-change-held-packages --no-install-recommends \
@@ -73,14 +73,14 @@ function install_efa {
7373
ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa
7474
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
7575
printf "Host *\n StrictHostKeyChecking no\n" >> /root/.ssh/config
76-
76+
7777
# Remove build time tools
7878
# apt-get remove -y
7979
# curl
8080
# build-essential
8181
# cmake
8282
# git
83-
83+
8484
# Cleanup
8585
apt-get clean
8686
apt-get autoremove -y
@@ -93,7 +93,7 @@ function install_efa {
9393
while test $# -gt 0
9494
do
9595
case "$1" in
96-
[0-9].[0-9]*.[0-9]*) install_efa $1;
96+
[0-9].[0-9]*.[0-9]*) install_efa $1;
9797
;;
9898
*) echo "bad argument $1"; exit 1
9999
;;

scripts/telemetry/bash_telemetry.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# telemetry.sh
21
#!/bin/bash
2+
# telemetry.sh
33
if [ -f /usr/local/bin/deep_learning_container.py ] && [[ -z "${OPT_OUT_TRACKING}" || "${OPT_OUT_TRACKING,,}" != "true" ]]; then
44
(
55
python /usr/local/bin/deep_learning_container.py \

scripts/telemetry/deep_learning_container.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python3
12
# Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License"). You
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Execute telemetry script if it exists, suppress errors
44
bash /usr/local/bin/bash_telemetry.sh >/dev/null 2>&1 || true
55

6-
python3 -m vllm.entrypoints.openai.api_server "$@"
6+
python3 -m vllm.entrypoints.openai.api_server "$@"

0 commit comments

Comments
 (0)