-
Notifications
You must be signed in to change notification settings - Fork 74
chore/add npu ci image build step #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| steps: | ||
| - label: ":docker: Build and Push NPU Test Image - A3" | ||
| key: image-build-npu | ||
| depends_on: | ||
| - pre-commit-npu | ||
| - npu-gate | ||
| timeout_in_minutes: 240 | ||
| skip: __SKIP_IMAGE_BUILD__ | ||
| agents: | ||
| queue: "ascend-a3" | ||
| resource_class: "npu-2" | ||
| plugins: | ||
| - kubernetes: | ||
| metadata: | ||
| annotations: | ||
| vault.hashicorp.com/agent-init-first: "true" | ||
| vault.hashicorp.com/agent-inject: "true" | ||
| vault.hashicorp.com/agent-inject-perms-ca.pem: "0400" | ||
| vault.hashicorp.com/agent-inject-perms-cert.pem: "0400" | ||
| vault.hashicorp.com/agent-inject-perms-config.json: "0400" | ||
| vault.hashicorp.com/agent-inject-perms-key.pem: "0400" | ||
| vault.hashicorp.com/agent-inject-secret-ca.pem: internal/data/ascend/buildkitd | ||
| vault.hashicorp.com/agent-inject-secret-cert.pem: internal/data/ascend/buildkitd | ||
| vault.hashicorp.com/agent-inject-secret-config.json: internal/data/ascend/buildkitd | ||
| vault.hashicorp.com/agent-inject-secret-key.pem: internal/data/ascend/buildkitd | ||
| vault.hashicorp.com/agent-inject-template-ca.pem: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.RootCA }}\n{{- end }}" | ||
| vault.hashicorp.com/agent-inject-template-cert.pem: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.ClientCaCert }}\n{{- end }}" | ||
| vault.hashicorp.com/agent-inject-template-config.json: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.dockerConfig }}\n{{- end }}" | ||
| vault.hashicorp.com/agent-inject-template-key.pem: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.ClientCaKey }}\n{{- end }}" | ||
| vault.hashicorp.com/agent-pre-populate-only: "true" | ||
| vault.hashicorp.com/agent-run-as-group: "1000" | ||
| vault.hashicorp.com/agent-run-as-user: "1000" | ||
| vault.hashicorp.com/agent-service-account-token-volume-name: token-vol | ||
| vault.hashicorp.com/role: ascend-gha-runners | ||
| vault.hashicorp.com/secret-volume-path: /home/user/.docker/ | ||
| vault.hashicorp.com/tls-skip-verify: "true" | ||
| podSpecPatch: | ||
| volumes: | ||
| - name: token-vol | ||
| projected: | ||
| defaultMode: 420 | ||
| sources: | ||
| - serviceAccountToken: | ||
| audience: api | ||
| expirationSeconds: 600 | ||
| path: token | ||
| env: | ||
| VIME_IMAGE_TAG: "${BUILDKITE_COMMIT}" | ||
| IMAGE_NAME: "vime-ci-npu" | ||
| IMAGE_REGISTRY: "swr.cn-southwest-2.myhuaweicloud.com/modelfoundry" | ||
| BUILDKITD_ADDR: "tcp://buildkitd-service.buildkitd:1234" | ||
| command: | | ||
| set -ex | ||
| echo "--- Building and pushing NPU Test Image" | ||
| echo "Image: $${IMAGE_REGISTRY}/$${IMAGE_NAME}:$${VIME_IMAGE_TAG}" | ||
| echo "buildkitd address: $${BUILDKITD_ADDR}" | ||
|
|
||
| if ! command -v buildctl &> /dev/null; then | ||
| echo "Installing buildctl..." | ||
| mkdir -p /tmp/buildkit | ||
| BUILDKIT_VERSION="v0.29.0" | ||
| wget -q "https://gh-proxy.test.osinfra.cn/https://github.com/moby/buildkit/releases/download/$${BUILDKIT_VERSION}/buildkit-$${BUILDKIT_VERSION}.linux-arm64.tar.gz" -O /tmp/buildkit.tar.gz | ||
| tar -xzf /tmp/buildkit.tar.gz -C /tmp/buildkit | ||
| cp /tmp/buildkit/bin/buildctl /usr/local/bin/ | ||
| fi | ||
|
|
||
| sed -i '/^RUN git config --global http.sslVerify false/i RUN git config --global url."https://gh-proxy.test.osinfra.cn/https://github.com/".insteadOf "https://github.com/"' docker/Dockerfile.npu | ||
| sed -i '/^# syntax=docker\/dockerfile:1\.7$$/d' docker/Dockerfile.npu | ||
|
|
||
| export DOCKER_CONFIG=/home/user/.docker | ||
| buildctl \ | ||
| --addr="$${BUILDKITD_ADDR}" \ | ||
| --tlscacert=/home/user/.docker/ca.pem \ | ||
| --tlscert=/home/user/.docker/cert.pem \ | ||
| --tlskey=/home/user/.docker/key.pem \ | ||
| build \ | ||
| --frontend dockerfile.v0 \ | ||
| --local context=. \ | ||
| --local dockerfile=./docker \ | ||
| --opt filename=Dockerfile.npu \ | ||
| --opt build-arg:BASE_IMAGE=swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/vllm-ascend/vllm-ascend \ | ||
| --opt build-arg:APTMIRROR=http://cache-service.nginx-pypi-cache.svc.cluster.local:8081 \ | ||
| --opt build-arg:PIP_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple \ | ||
| --secret id=dockerconfig,src=/home/user/.docker/config.json \ | ||
| --output type=image,name=$${IMAGE_REGISTRY}/$${IMAGE_NAME}:$${VIME_IMAGE_TAG},push=true \ | ||
| --progress=plain | ||
|
|
||
| echo "--- Image pushed successfully" | ||
| echo "$${IMAGE_REGISTRY}/$${IMAGE_NAME}:$${VIME_IMAGE_TAG}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,109 +45,34 @@ steps: | |
| multiple: true | ||
| required: true | ||
| options: | ||
| - label: "run-npu-ci-image-build (test new image, auto include smk)" | ||
| value: image-build | ||
| - label: "run-npu-ci-smk" | ||
| value: smk | ||
| - label: "run-npu-ci-nightly" | ||
| value: nightly | ||
|
|
||
| # - label: ":buildkit: Build and Push NPU Test Image - A3" | ||
| # key: image-build-npu | ||
| # depends_on: pre-commit-npu | ||
| # if: __IMAGE_BUILD_IF__ == true | ||
| # timeout_in_minutes: 240 | ||
| # agents: | ||
| # queue: "ascend-a3" | ||
| # resource_class: "npu-2" | ||
| # plugins: | ||
| # - kubernetes: | ||
| # metadata: | ||
| # annotations: | ||
| # vault.hashicorp.com/agent-init-first: "true" | ||
| # vault.hashicorp.com/agent-inject: "true" | ||
| # vault.hashicorp.com/agent-inject-perms-ca.pem: "0400" | ||
| # vault.hashicorp.com/agent-inject-perms-cert.pem: "0400" | ||
| # vault.hashicorp.com/agent-inject-perms-config.json: "0400" | ||
| # vault.hashicorp.com/agent-inject-perms-key.pem: "0400" | ||
| # vault.hashicorp.com/agent-inject-secret-ca.pem: internal/data/ascend/buildkitd | ||
| # vault.hashicorp.com/agent-inject-secret-cert.pem: internal/data/ascend/buildkitd | ||
| # vault.hashicorp.com/agent-inject-secret-config.json: internal/data/ascend/buildkitd | ||
| # vault.hashicorp.com/agent-inject-secret-key.pem: internal/data/ascend/buildkitd | ||
| # vault.hashicorp.com/agent-inject-template-ca.pem: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.RootCA }}\n{{- end }}" | ||
| # vault.hashicorp.com/agent-inject-template-cert.pem: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.ClientCaCert }}\n{{- end }}" | ||
| # vault.hashicorp.com/agent-inject-template-config.json: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.dockerConfig }}\n{{- end }}" | ||
| # vault.hashicorp.com/agent-inject-template-key.pem: "{{- with secret \"internal/data/ascend/buildkitd\" -}}\n{{ .Data.data.ClientCaKey }}\n{{- end }}" | ||
| # vault.hashicorp.com/agent-pre-populate-only: "true" | ||
| # vault.hashicorp.com/agent-run-as-group: "1000" | ||
| # vault.hashicorp.com/agent-run-as-user: "1000" | ||
| # vault.hashicorp.com/agent-service-account-token-volume-name: token-vol | ||
| # vault.hashicorp.com/role: ascend-gha-runners | ||
| # vault.hashicorp.com/secret-volume-path: /home/user/.docker/ | ||
| # vault.hashicorp.com/tls-skip-verify: "true" | ||
| # podSpecPatch: | ||
| # volumes: | ||
| # - name: token-vol | ||
| # projected: | ||
| # defaultMode: 420 | ||
| # sources: | ||
| # - serviceAccountToken: | ||
| # audience: api | ||
| # expirationSeconds: 600 | ||
| # path: token | ||
| # env: | ||
| # VIME_IMAGE_TAG: "${BUILDKITE_COMMIT}" | ||
| # IMAGE_NAME: "vime-ci-npu" | ||
| # IMAGE_REGISTRY: "swr.cn-southwest-2.myhuaweicloud.com/modelfoundry" | ||
| # BUILDKITD_ADDR: "tcp://buildkitd-service.buildkitd:1234" | ||
| # command: | | ||
| # set -ex | ||
| # | ||
| # echo "--- Building and pushing NPU Test Image" | ||
| # echo "Image: $${IMAGE_REGISTRY}/$${IMAGE_NAME}:$${VIME_IMAGE_TAG}" | ||
| # echo "buildkitd address: $${BUILDKITD_ADDR}" | ||
| # | ||
| # if ! command -v buildctl &> /dev/null; then | ||
| # echo "Installing buildctl..." | ||
| # mkdir -p /tmp/buildkit | ||
| # BUILDKIT_VERSION="v0.29.0" | ||
| # wget -q "https://gh-proxy.test.osinfra.cn/https://github.com/moby/buildkit/releases/download/$${BUILDKIT_VERSION}/buildkit-$${BUILDKIT_VERSION}.linux-arm64.tar.gz" -O /tmp/buildkit.tar.gz | ||
| # tar -xzf /tmp/buildkit.tar.gz -C /tmp/buildkit | ||
| # cp /tmp/buildkit/bin/buildctl /usr/local/bin/ | ||
| # fi | ||
| # | ||
| # sed -i '/^RUN git config --global http.sslVerify false/i RUN git config --global url."https://gh-proxy.test.osinfra.cn/https://github.com/".insteadOf "https://github.com/"' docker/Dockerfile.npu | ||
| # sed -i '/^# syntax=docker\/dockerfile:1\.7$$/d' docker/Dockerfile.npu | ||
| # | ||
| # export DOCKER_CONFIG=/home/user/.docker | ||
| # buildctl \ | ||
| # --addr="$${BUILDKITD_ADDR}" \ | ||
| # --tlscacert=/home/user/.docker/ca.pem \ | ||
| # --tlscert=/home/user/.docker/cert.pem \ | ||
| # --tlskey=/home/user/.docker/key.pem \ | ||
| # build \ | ||
| # --frontend dockerfile.v0 \ | ||
| # --local context=. \ | ||
| # --local dockerfile=./docker \ | ||
| # --opt filename=Dockerfile.npu \ | ||
| # --opt build-arg:APTMIRROR=http://cache-service.nginx-pypi-cache.svc.cluster.local:8081 \ | ||
| # --opt build-arg:PIP_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple \ | ||
| # --secret id=dockerconfig,src=/home/user/.docker/config.json \ | ||
| # --output type=image,name=$${IMAGE_REGISTRY}/$${IMAGE_NAME}:$${VIME_IMAGE_TAG},push=true \ | ||
| # --progress=plain | ||
| # | ||
| # echo "--- Image pushed successfully" | ||
| # echo "$${IMAGE_REGISTRY}/$${IMAGE_NAME}:$${VIME_IMAGE_TAG}" | ||
|
|
||
| - label: ":pipeline: upload NPU suites" | ||
| key: upload-npu-suites | ||
| depends_on: | ||
| - npu-gate | ||
|
Comment on lines
+57
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On scheduled builds (nightly runs), the To fix this, define the dependency on depends_on:
- step: pre-commit-npu
- step: npu-gate
allow_failure: true |
||
| - pre-commit-npu | ||
| agents: | ||
| queue: "ascend-a3" | ||
| resource_class: "npu-2" | ||
| timeout_in_minutes: 180 | ||
| command: | | ||
| export IMAGE_BUILD="quay.io/ascend/vime:0.3.0-a3-vllm0.22.1rc1" | ||
| echo "IMAGE_BUILD: $${IMAGE_BUILD}" | ||
| python .buildkite/npu_suites.py | buildkite-agent pipeline upload | ||
|
|
||
| NPU_SUITES=$$(buildkite-agent meta-data get "npu-suites" --default "") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modified according to the recommendation. Check build.source == "schedule" to determine if triggered on a scheduled time. If yes, execute the build image. Readme has been updated. |
||
| if [[ "$$BUILDKITE_SOURCE" == "schedule" ]]; then | ||
| echo "Scheduled build — building the image." | ||
| echo "BUILDKITE_SOURCE: $$BUILDKITE_SOURCE" | ||
| SKIP_IMAGE_BUILD=false | ||
| elif [[ "$$NPU_SUITES" == *"image-build"* ]]; then | ||
| echo "image-build selected — building the image." | ||
| echo "NPU_SUITES: $$NPU_SUITES" | ||
| SKIP_IMAGE_BUILD=false | ||
| else | ||
| echo "Skipping image build because image-build is not present in the npu-suites." | ||
| SKIP_IMAGE_BUILD=true | ||
| fi | ||
| sed -e "s/__SKIP_IMAGE_BUILD__/$${SKIP_IMAGE_BUILD}/g" .buildkite/pipeline-npu-image.yaml | buildkite-agent pipeline upload | ||
| python .buildkite/npu_suites.py | buildkite-agent pipeline upload | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selecting only image-build uploads zero test steps, so the build can pass without testing the image. Could we require include smk by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified npu-suites.py will determine whether image-build is selected to add SMK tests by default.