Skip to content

Commit bcb2bd7

Browse files
dhuangnmdhuangnm
andauthored
Add docker workflow to nm nightly/release and fixed some minor bugs in wheel uploading (vllm-project#334)
1. Added/updated publish docker workflow into nightly/release workflow. 2. Fixed minor bugs in wheel uploading to GCP due to one wheel changes. 3. Removed duplicate upload code. --------- Co-authored-by: dhuangnm <dhuang@MacBook-Pro-2.local>
1 parent 05c3004 commit bcb2bd7

File tree

7 files changed

+98
-69
lines changed

7 files changed

+98
-69
lines changed

.github/actions/nm-build-docker/action.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@ description: 'build docker image for nm-vllm'
33
inputs:
44
docker_tag:
55
description: "tag to be used for the docker image"
6-
type: string
76
required: true
87
extra_tag:
98
description: "additional tag for the docker image"
10-
type: string
119
required: true
12-
build_type:
10+
wf_category:
1311
description: "type of nm-vllm to install for the docker image: NIGHTLY (default) or RELEASE"
14-
type: string
15-
default: 'NIGHTLY'
12+
required: true
1613
build_version:
1714
description: "version of nm-vllm to install for the docker image: latest (default) or specific version e.g. 0.4.0, 0.4.0.20240531"
18-
type: string
19-
default: 'latest'
15+
required: true
2016
runs:
2117
using: composite
2218
steps:
@@ -29,11 +25,11 @@ runs:
2925
# build
3026
status=0
3127
docker build --tag ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.docker_tag }} \
32-
--build-arg build_type=${{ inputs.build_type }} \
28+
--build-arg build_type=${{ inputs.wf_category }} \
3329
--build-arg build_version=${{ inputs.build_version }} \
3430
--target vllm-openai . || status=$?
3531
if [ ${status} -eq 0 ]; then
36-
echo "Add tag ${{ inputs.extra_tag }} for "${{ inputs.build_type }}" build too"
32+
echo "Add tag ${{ inputs.extra_tag }} for "${{ inputs.wf_category }}" build too"
3733
docker image tag ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.docker_tag }} ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.extra_tag }} || ((status+=$?))
3834
fi
3935
docker image ls -a

.github/actions/nm-cp-assets/action.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
name: cp assets
22
description: "cp whl and tarfile to Google storage 'neuralmagic-public-pypi/dist'"
3-
inputs:
4-
python:
5-
description: 'python version, e.g. 3.10.12'
6-
required: true
73
runs:
84
using: composite
95
steps:
10-
- id: mv_assets
6+
- id: cp_assets
117
run: |
12-
VERSION_BASE=$(./.github/scripts/convert-version ${{ inputs.python }})
13-
WHL=$(find assets -type f -name "*nm_vllm*${VERSION_BASE}*.whl")
8+
WHL=$(find assets -type f -name "*nm_vllm*.whl")
149
WHL_FILE=$(basename ${WHL})
1510
echo "whl: ${WHL}"
1611
echo "whl_file: ${WHL_FILE}"
17-
TAR=$(find assets -path "*${{ inputs.python }}-nm-vllm*.tar.gz" -type f -name "nm-vllm*.tar.gz")
12+
TAR=$(find assets -path "*nm-vllm*.tar.gz" -type f -name "nm-vllm*.tar.gz")
1813
TAR_FILE=$(basename ${TAR})
1914
echo "tar: ${TAR}"
2015
echo "tar_file: ${TAR_FILE}"

.github/actions/nm-get-docker-tag/action.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Get docker image tags based on build type and the image version based on wheel name
2+
description: 'docker image tags for nm-vllm'
3+
inputs:
4+
wf_category:
5+
description: "type of nm-vllm to install for the docker image: NIGHTLY or RELEASE"
6+
required: true
7+
wheel:
8+
description: "wheel name, if latest use the latest from nm pypi"
9+
required: true
10+
outputs:
11+
tag:
12+
description: "tag for the docker image based on wheel version"
13+
value: ${{ steps.tags.outputs.tag }}
14+
extra_tag:
15+
description: "extra tag for the docker image based on build type, either latest (for RELEASE) or nightly (for NIGHTLY)"
16+
value: ${{ steps.tags.outputs.extra_tag }}
17+
build_version:
18+
"version of nm-vllm, e.g. 0.4.0, 0.4.0.20240531"
19+
value: ${{ steps.tags.outputs.build_version }}
20+
runs:
21+
using: composite
22+
steps:
23+
- id: tags
24+
run: |
25+
BUILD_VERSION=`echo "${{ inputs.wheel }} | cut -d'-' -f2`
26+
if [[ "${{ inputs.wf_category }}" = "RELEASE" ]]; then
27+
TAG="v${build_version}"
28+
EXTRA_TAG=latest
29+
else
30+
TAG=`echo "${build_version}" | cut -d'.' -f4`
31+
EXTRA_TAG=nightly
32+
fi
33+
if [[ "${{ inputs.wheel }} = 'latest' ]]; then
34+
BUILD_VERSION='latest'
35+
fi
36+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
37+
echo "extra_tag=${EXTRA_TAG}" >> $GITHUB_OUTPUT
38+
echo "build_version=${BUILD_VERSION}" >> $GITHUB_OUTPUT
39+
shell: bash

.github/workflows/nm-build-test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
timeout: ${{ inputs.test_timeout }}
130130
gitref: ${{ github.ref }}
131131
python: ${{ matrix.test_config.python }}
132-
whl: ${{ needs.BUILD.output.whl }}
132+
whl: ${{ needs.BUILD.outputs.whl }}
133133
test_skip_env_vars: ${{ matrix.test_config.test }}
134134
secrets: inherit
135135

@@ -169,5 +169,16 @@ jobs:
169169
label: gcp-k8s-util
170170
timeout: ${{ inputs.build_timeout }}
171171
gitref: ${{ github.ref }}
172-
python: ${{ inputs.python }}
172+
secrets: inherit
173+
174+
# update docker
175+
DOCKER:
176+
needs: [BUILD, UPLOAD]
177+
if: ${{ inputs.push_to_pypi }}
178+
uses: ./.github/workflows/publish-docker.yml
179+
with:
180+
push_to_repository: ${{ inputs.push_to_pypi }}
181+
gitref: ${{ inputs.gitref }}
182+
wf_category: ${{ inputs.wf_category }}
183+
wheel: ${{ needs.BUILD.outputs.whl }}
173184
secrets: inherit

.github/workflows/nm-upload-assets-to-gcp.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ on:
1616
description: 'git commit hash or branch name'
1717
type: string
1818
required: true
19-
python:
20-
description: "python version, e.g. 3.10.12"
21-
type: string
22-
required: true
2319

2420
jobs:
2521

@@ -74,5 +70,3 @@ jobs:
7470
- name: cp assets
7571
id: cp-assets
7672
uses: ./.github/actions/nm-cp-assets/
77-
with:
78-
python: ${{ inputs.python }}
Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
name: Docker Build + Publish
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
55
inputs:
6-
docker_tag:
7-
description: "tag to be used for the docker image"
8-
type: string
9-
required: true
106
push_to_repository:
11-
description: "whether to push out the docker image: no (default) or yes"
7+
description: "whether to push out the docker image: false (default) or true"
8+
type: boolean
9+
default: false
10+
gitref:
11+
description: "git commit hash or branch name"
12+
type: string
13+
default: 'main'
14+
wf_category:
15+
description: "type of nm-vllm to install for the docker image: NIGHTLY (default) or RELEASE"
1216
type: string
13-
default: 'no'
17+
default: 'NIGHTLY'
18+
wheel:
19+
description: "nm-vllm wheel to install for the docker image: latest (default) or specific wheel name"
20+
type: string
21+
default: 'latest'
22+
23+
workflow_dispatch:
24+
inputs:
25+
push_to_repository:
26+
description: "whether to push out the docker image: false (default) or true"
27+
type: boolean
28+
default: false
1429
gitref:
1530
description: "git commit hash or branch name"
1631
type: string
1732
default: 'main'
18-
build_type:
33+
wf_category:
1934
description: "type of nm-vllm to install for the docker image: NIGHTLY (default) or RELEASE"
2035
type: string
2136
default: 'NIGHTLY'
22-
build_version:
23-
description: "version of nm-vllm to install for the docker image: latest (default) or specific version e.g. 0.4.0, 0.4.0.20240531"
37+
wheel:
38+
description: "nm-vllm wheel to install for the docker image: latest (default) or specific wheel name"
2439
type: string
2540
default: 'latest'
2641

@@ -50,35 +65,36 @@ jobs:
5065
id: setup
5166
uses: ./.github/actions/nm-setup-nvidia-container-toolkit/
5267

53-
- name: Get docker image extra tag
54-
id: tag
55-
uses: ./.github/actions/nm-get-docker-tag/
68+
- name: Get docker image tags
69+
id: tags
70+
uses: ./.github/actions/nm-get-docker-tags/
5671
with:
57-
build_type: ${{ inputs.build_type }}
72+
wf_category: ${{ inputs.wf_category }}
73+
wheel: ${{ inputs.wheel }}
5874

5975
- name: Build image
6076
id: build
6177
uses: ./.github/actions/nm-build-docker/
6278
with:
63-
docker_tag: ${{ inputs.docker_tag }}
64-
extra_tag: ${{ steps.tag.outputs.tag }}
65-
build_type: ${{ inputs.build_type }}
66-
build_version: ${{ inputs.build_version }}
79+
docker_tag: ${{ steps.tags.outputs.tag }}
80+
extra_tag: ${{ steps.tags.outputs.extra_tag }}
81+
wf_category: ${{ inputs.wf_category }}
82+
build_version: ${{ steps.tags.outputs.build_version }}
6783

6884
- name: Push image
6985
uses: docker/build-push-action@v5
70-
if: ${{ inputs.push_to_repository == 'yes' && steps.build.outputs.status == 0 }}
86+
if: ${{ inputs.push_to_repository && steps.build.outputs.status == 0 }}
7187
with:
7288
context: .
7389
target: vllm-openai
7490
push: true
75-
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.docker_tag }}
91+
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ steps.tags.outputs.tag }}
7692

7793
- name: Push image
7894
uses: docker/build-push-action@v5
79-
if: ${{ inputs.push_to_repository == 'yes' && steps.build.outputs.status == 0 }}
95+
if: ${{ inputs.push_to_repository && steps.build.outputs.status == 0 }}
8096
with:
8197
context: .
8298
target: vllm-openai
8399
push: true
84-
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ steps.tag.outputs.tag }}
100+
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ steps.tags.outputs.extra_tag }}

0 commit comments

Comments
 (0)