| 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 4 | # |
| 5 | # Push CPU nightly images from ECR to Docker Hub as |
| 6 | # vllm/vllm-openai-cpu:nightly and vllm/vllm-openai-cpu:nightly-<commit>, |
| 7 | # combining the x86_64 and aarch64 architectures into a multi-arch manifest. |
| 8 | # Run when NIGHTLY=1 after the CPU release images have been pushed to ECR. |
| 9 | # |
| 10 | # Local testing (no push to Docker Hub): |
| 11 | # BUILDKITE_COMMIT=<commit-with-cpu-images-in-ecr> DRY_RUN=1 bash .buildkite/scripts/push-nightly-builds-cpu.sh |
| 12 | # Requires: AWS CLI configured (for ECR public login), Docker. For full run: Docker Hub login. |
| 13 | |
| 14 | set -ex |
| 15 | |
| 16 | # Use BUILDKITE_COMMIT from env (required; set to a commit that has CPU images in ECR for local test) |
| 17 | BUILDKITE_COMMIT="${BUILDKITE_COMMIT:?Set BUILDKITE_COMMIT to the commit SHA that has the CPU images in ECR (e.g. from a previous release pipeline run)}" |
| 18 | DRY_RUN="${DRY_RUN:-0}" |
| 19 | |
| 20 | TAG_NAME="nightly" |
| 21 | TAG_NAME_COMMIT="nightly-${BUILDKITE_COMMIT}" |
| 22 | |
| 23 | # arch-dependent source images in ECR (pushed by the CPU release image build steps) |
| 24 | X86_ORIG_TAG="public.ecr.aws/q9t5s3a7/vllm-cpu-release-repo:${BUILDKITE_COMMIT}-x86_64" |
| 25 | ARM64_ORIG_TAG="public.ecr.aws/q9t5s3a7/vllm-arm64-cpu-release-repo:${BUILDKITE_COMMIT}-arm64" |
| 26 | |
| 27 | echo "Pushing CPU release images from ECR to Docker Hub as $TAG_NAME and $TAG_NAME_COMMIT" |
| 28 | echo " x86_64: $X86_ORIG_TAG" |
| 29 | echo " arm64: $ARM64_ORIG_TAG" |
| 30 | [[ "$DRY_RUN" == "1" ]] && echo "[DRY_RUN] Skipping push to Docker Hub" |
| 31 | |
| 32 | # Login to ECR and pull the arch-dependent images |
| 33 | aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7 |
| 34 | docker pull "$X86_ORIG_TAG" |
| 35 | docker pull "$ARM64_ORIG_TAG" |
| 36 | |
| 37 | # Tag arch-dependent images for Docker Hub |
| 38 | docker tag "$X86_ORIG_TAG" vllm/vllm-openai-cpu:"$TAG_NAME"-x86_64 |
| 39 | docker tag "$ARM64_ORIG_TAG" vllm/vllm-openai-cpu:"$TAG_NAME"-arm64 |
| 40 | |
| 41 | if [[ "$DRY_RUN" == "1" ]]; then |
| 42 | echo "[DRY_RUN] Would push vllm/vllm-openai-cpu:$TAG_NAME-x86_64 and vllm/vllm-openai-cpu:$TAG_NAME-arm64" |
| 43 | echo "[DRY_RUN] Would create and push manifests vllm/vllm-openai-cpu:$TAG_NAME and vllm/vllm-openai-cpu:$TAG_NAME_COMMIT" |
| 44 | echo "[DRY_RUN] Local tags created. Exiting without push." |
| 45 | exit 0 |
| 46 | fi |
| 47 | |
| 48 | # Push arch-dependent images to Docker Hub |
| 49 | docker push vllm/vllm-openai-cpu:"$TAG_NAME"-x86_64 |
| 50 | docker push vllm/vllm-openai-cpu:"$TAG_NAME"-arm64 |
| 51 | |
| 52 | # Create and push the arch-independent manifests |
| 53 | docker manifest create vllm/vllm-openai-cpu:"$TAG_NAME" vllm/vllm-openai-cpu:"$TAG_NAME"-x86_64 vllm/vllm-openai-cpu:"$TAG_NAME"-arm64 --amend |
| 54 | docker manifest create vllm/vllm-openai-cpu:"$TAG_NAME_COMMIT" vllm/vllm-openai-cpu:"$TAG_NAME"-x86_64 vllm/vllm-openai-cpu:"$TAG_NAME"-arm64 --amend |
| 55 | docker manifest push vllm/vllm-openai-cpu:"$TAG_NAME" |
| 56 | docker manifest push vllm/vllm-openai-cpu:"$TAG_NAME_COMMIT" |
| 57 | |
| 58 | echo "Pushed vllm/vllm-openai-cpu:$TAG_NAME and vllm/vllm-openai-cpu:$TAG_NAME_COMMIT" |