Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Add docker workflow to nm nightly/release and fixed some minor bugs i…
Browse files Browse the repository at this point in the history
…n wheel uploading (#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>
  • Loading branch information
dhuangnm and dhuangnm authored Jun 25, 2024
1 parent 05c3004 commit bcb2bd7
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 69 deletions.
14 changes: 5 additions & 9 deletions .github/actions/nm-build-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ description: 'build docker image for nm-vllm'
inputs:
docker_tag:
description: "tag to be used for the docker image"
type: string
required: true
extra_tag:
description: "additional tag for the docker image"
type: string
required: true
build_type:
wf_category:
description: "type of nm-vllm to install for the docker image: NIGHTLY (default) or RELEASE"
type: string
default: 'NIGHTLY'
required: true
build_version:
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"
type: string
default: 'latest'
required: true
runs:
using: composite
steps:
Expand All @@ -29,11 +25,11 @@ runs:
# build
status=0
docker build --tag ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.docker_tag }} \
--build-arg build_type=${{ inputs.build_type }} \
--build-arg build_type=${{ inputs.wf_category }} \
--build-arg build_version=${{ inputs.build_version }} \
--target vllm-openai . || status=$?
if [ ${status} -eq 0 ]; then
echo "Add tag ${{ inputs.extra_tag }} for "${{ inputs.build_type }}" build too"
echo "Add tag ${{ inputs.extra_tag }} for "${{ inputs.wf_category }}" build too"
docker image tag ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.docker_tag }} ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.extra_tag }} || ((status+=$?))
fi
docker image ls -a
Expand Down
11 changes: 3 additions & 8 deletions .github/actions/nm-cp-assets/action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
name: cp assets
description: "cp whl and tarfile to Google storage 'neuralmagic-public-pypi/dist'"
inputs:
python:
description: 'python version, e.g. 3.10.12'
required: true
runs:
using: composite
steps:
- id: mv_assets
- id: cp_assets
run: |
VERSION_BASE=$(./.github/scripts/convert-version ${{ inputs.python }})
WHL=$(find assets -type f -name "*nm_vllm*${VERSION_BASE}*.whl")
WHL=$(find assets -type f -name "*nm_vllm*.whl")
WHL_FILE=$(basename ${WHL})
echo "whl: ${WHL}"
echo "whl_file: ${WHL_FILE}"
TAR=$(find assets -path "*${{ inputs.python }}-nm-vllm*.tar.gz" -type f -name "nm-vllm*.tar.gz")
TAR=$(find assets -path "*nm-vllm*.tar.gz" -type f -name "nm-vllm*.tar.gz")
TAR_FILE=$(basename ${TAR})
echo "tar: ${TAR}"
echo "tar_file: ${TAR_FILE}"
Expand Down
22 changes: 0 additions & 22 deletions .github/actions/nm-get-docker-tag/action.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/actions/nm-get-docker-tags/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Get docker image tags based on build type and the image version based on wheel name
description: 'docker image tags for nm-vllm'
inputs:
wf_category:
description: "type of nm-vllm to install for the docker image: NIGHTLY or RELEASE"
required: true
wheel:
description: "wheel name, if latest use the latest from nm pypi"
required: true
outputs:
tag:
description: "tag for the docker image based on wheel version"
value: ${{ steps.tags.outputs.tag }}
extra_tag:
description: "extra tag for the docker image based on build type, either latest (for RELEASE) or nightly (for NIGHTLY)"
value: ${{ steps.tags.outputs.extra_tag }}
build_version:
"version of nm-vllm, e.g. 0.4.0, 0.4.0.20240531"
value: ${{ steps.tags.outputs.build_version }}
runs:
using: composite
steps:
- id: tags
run: |
BUILD_VERSION=`echo "${{ inputs.wheel }} | cut -d'-' -f2`
if [[ "${{ inputs.wf_category }}" = "RELEASE" ]]; then
TAG="v${build_version}"
EXTRA_TAG=latest
else
TAG=`echo "${build_version}" | cut -d'.' -f4`
EXTRA_TAG=nightly
fi
if [[ "${{ inputs.wheel }} = 'latest' ]]; then
BUILD_VERSION='latest'
fi
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "extra_tag=${EXTRA_TAG}" >> $GITHUB_OUTPUT
echo "build_version=${BUILD_VERSION}" >> $GITHUB_OUTPUT
shell: bash
15 changes: 13 additions & 2 deletions .github/workflows/nm-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
timeout: ${{ inputs.test_timeout }}
gitref: ${{ github.ref }}
python: ${{ matrix.test_config.python }}
whl: ${{ needs.BUILD.output.whl }}
whl: ${{ needs.BUILD.outputs.whl }}
test_skip_env_vars: ${{ matrix.test_config.test }}
secrets: inherit

Expand Down Expand Up @@ -169,5 +169,16 @@ jobs:
label: gcp-k8s-util
timeout: ${{ inputs.build_timeout }}
gitref: ${{ github.ref }}
python: ${{ inputs.python }}
secrets: inherit

# update docker
DOCKER:
needs: [BUILD, UPLOAD]
if: ${{ inputs.push_to_pypi }}
uses: ./.github/workflows/publish-docker.yml
with:
push_to_repository: ${{ inputs.push_to_pypi }}
gitref: ${{ inputs.gitref }}
wf_category: ${{ inputs.wf_category }}
wheel: ${{ needs.BUILD.outputs.whl }}
secrets: inherit
6 changes: 0 additions & 6 deletions .github/workflows/nm-upload-assets-to-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ on:
description: 'git commit hash or branch name'
type: string
required: true
python:
description: "python version, e.g. 3.10.12"
type: string
required: true

jobs:

Expand Down Expand Up @@ -74,5 +70,3 @@ jobs:
- name: cp assets
id: cp-assets
uses: ./.github/actions/nm-cp-assets/
with:
python: ${{ inputs.python }}
60 changes: 38 additions & 22 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
name: Docker Build + Publish

on:
workflow_dispatch:
workflow_call:
inputs:
docker_tag:
description: "tag to be used for the docker image"
type: string
required: true
push_to_repository:
description: "whether to push out the docker image: no (default) or yes"
description: "whether to push out the docker image: false (default) or true"
type: boolean
default: false
gitref:
description: "git commit hash or branch name"
type: string
default: 'main'
wf_category:
description: "type of nm-vllm to install for the docker image: NIGHTLY (default) or RELEASE"
type: string
default: 'no'
default: 'NIGHTLY'
wheel:
description: "nm-vllm wheel to install for the docker image: latest (default) or specific wheel name"
type: string
default: 'latest'

workflow_dispatch:
inputs:
push_to_repository:
description: "whether to push out the docker image: false (default) or true"
type: boolean
default: false
gitref:
description: "git commit hash or branch name"
type: string
default: 'main'
build_type:
wf_category:
description: "type of nm-vllm to install for the docker image: NIGHTLY (default) or RELEASE"
type: string
default: 'NIGHTLY'
build_version:
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"
wheel:
description: "nm-vllm wheel to install for the docker image: latest (default) or specific wheel name"
type: string
default: 'latest'

Expand Down Expand Up @@ -50,35 +65,36 @@ jobs:
id: setup
uses: ./.github/actions/nm-setup-nvidia-container-toolkit/

- name: Get docker image extra tag
id: tag
uses: ./.github/actions/nm-get-docker-tag/
- name: Get docker image tags
id: tags
uses: ./.github/actions/nm-get-docker-tags/
with:
build_type: ${{ inputs.build_type }}
wf_category: ${{ inputs.wf_category }}
wheel: ${{ inputs.wheel }}

- name: Build image
id: build
uses: ./.github/actions/nm-build-docker/
with:
docker_tag: ${{ inputs.docker_tag }}
extra_tag: ${{ steps.tag.outputs.tag }}
build_type: ${{ inputs.build_type }}
build_version: ${{ inputs.build_version }}
docker_tag: ${{ steps.tags.outputs.tag }}
extra_tag: ${{ steps.tags.outputs.extra_tag }}
wf_category: ${{ inputs.wf_category }}
build_version: ${{ steps.tags.outputs.build_version }}

- name: Push image
uses: docker/build-push-action@v5
if: ${{ inputs.push_to_repository == 'yes' && steps.build.outputs.status == 0 }}
if: ${{ inputs.push_to_repository && steps.build.outputs.status == 0 }}
with:
context: .
target: vllm-openai
push: true
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ inputs.docker_tag }}
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ steps.tags.outputs.tag }}

- name: Push image
uses: docker/build-push-action@v5
if: ${{ inputs.push_to_repository == 'yes' && steps.build.outputs.status == 0 }}
if: ${{ inputs.push_to_repository && steps.build.outputs.status == 0 }}
with:
context: .
target: vllm-openai
push: true
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ steps.tag.outputs.tag }}
tags: ghcr.io/neuralmagic/nm-vllm-openai:${{ steps.tags.outputs.extra_tag }}

0 comments on commit bcb2bd7

Please sign in to comment.