|
| 1 | +name: Build, test, and publish vLLM CPU Containers |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - rhoai-v* |
| 8 | + - konflux-poc* |
| 9 | + types: |
| 10 | + - opened |
| 11 | + - synchronize |
| 12 | + paths: |
| 13 | + - 'vllm/Containerfile' |
| 14 | + push: |
| 15 | + branches: |
| 16 | + - main |
| 17 | + - rhoai-v* |
| 18 | + paths: |
| 19 | + - 'vllm/Containerfile' |
| 20 | + workflow_dispatch: |
| 21 | + inputs: |
| 22 | + inference_model: |
| 23 | + description: 'Inference model to preload onto vLLM image - default is Qwen/Qwen3-0.6B' |
| 24 | + type: string |
| 25 | + embedding_model: |
| 26 | + description: 'Embedding model to preload onto vLLM image - default is ibm-granite/granite-embedding-125m-english' |
| 27 | + type: string |
| 28 | + |
| 29 | +env: |
| 30 | + REGISTRY: quay.io |
| 31 | + IMAGE_NAME: quay.io/opendatahub/vllm-cpu # tags for the image will be added dynamically |
| 32 | + |
| 33 | +jobs: |
| 34 | + build-test-push: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + env: |
| 37 | + INFERENCE_MODEL: ${{ github.event.inputs.inference_model || 'Qwen/Qwen3-0.6B' }} |
| 38 | + EMBEDDING_MODEL: ${{ github.event.inputs.embedding_model || 'ibm-granite/granite-embedding-125m-english' }} |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + platform: [linux/amd64] # TODO: enable other arch once all pip packages are available. |
| 42 | + permissions: |
| 43 | + contents: read |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout repository |
| 47 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 48 | + |
| 49 | + - name: Set image tag components |
| 50 | + run: | |
| 51 | + INFERENCE_TEMP="${INFERENCE_MODEL#*/}" |
| 52 | + EMBEDDING_TEMP="${EMBEDDING_MODEL#*/}" |
| 53 | + echo "INFERENCE_TAG=${INFERENCE_TEMP%-*}" >> "$GITHUB_ENV" |
| 54 | + echo "EMBEDDING_TAG=${EMBEDDING_TEMP%-*}" >> "$GITHUB_ENV" |
| 55 | +
|
| 56 | + - name: Install uv |
| 57 | + uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 |
| 58 | + with: |
| 59 | + python-version: 3.12 |
| 60 | + |
| 61 | + - name: Set up QEMU |
| 62 | + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 |
| 63 | + |
| 64 | + - name: Set up Docker Buildx |
| 65 | + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 |
| 66 | + |
| 67 | + - name: Free disk space |
| 68 | + uses: ./.github/actions/free-disk-space |
| 69 | + |
| 70 | + - name: Build image |
| 71 | + id: build |
| 72 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 |
| 73 | + with: |
| 74 | + context: . |
| 75 | + file: vllm/Containerfile |
| 76 | + platforms: ${{ matrix.platform }} |
| 77 | + push: false |
| 78 | + tags: ${{ env.IMAGE_NAME }}:${{ env.INFERENCE_TAG }}-${{ env.EMBEDDING_TAG }} |
| 79 | + load: true # needed to load for smoke test |
| 80 | + build-args: | |
| 81 | + INFERENCE_MODEL=${{ env.INFERENCE_MODEL }} |
| 82 | + EMBEDDING_MODEL=${{ env.EMBEDDING_MODEL }} |
| 83 | +
|
| 84 | + - name: Setup vllm for inference test |
| 85 | + if: github.event_name != 'workflow_dispatch' |
| 86 | + id: vllm-inference |
| 87 | + uses: ./.github/actions/setup-vllm |
| 88 | + env: |
| 89 | + VLLM_IMAGE: ${{ env.IMAGE_NAME }}:${{ env.INFERENCE_TAG }}-${{ env.EMBEDDING_TAG }} |
| 90 | + VLLM_MODE: 'inference' |
| 91 | + |
| 92 | + - name: Setup vllm for embedding test |
| 93 | + if: github.event_name != 'workflow_dispatch' |
| 94 | + id: vllm-embedding |
| 95 | + uses: ./.github/actions/setup-vllm |
| 96 | + env: |
| 97 | + VLLM_IMAGE: ${{ env.IMAGE_NAME }}:${{ env.INFERENCE_TAG }}-${{ env.EMBEDDING_TAG }} |
| 98 | + VLLM_MODE: 'embedding' |
| 99 | + |
| 100 | + - name: Gather logs and debugging information |
| 101 | + if: always() |
| 102 | + shell: bash |
| 103 | + run: | |
| 104 | + # Create logs directory |
| 105 | + mkdir -p logs |
| 106 | +
|
| 107 | + docker logs vllm-inference > logs/vllm-inference.log 2>&1 || echo "Failed to get vllm-inference logs" > logs/vllm-inference.log |
| 108 | + docker logs vllm-embedding > logs/vllm-embedding.log 2>&1 || echo "Failed to get vllm-embedding logs" > logs/vllm-embedding.log |
| 109 | +
|
| 110 | + # Gather system information |
| 111 | + echo "=== System information ===" |
| 112 | + { |
| 113 | + echo "Disk usage:" |
| 114 | + df -h |
| 115 | + echo "Memory usage:" |
| 116 | + free -h |
| 117 | + echo "Docker images:" |
| 118 | + docker images |
| 119 | + echo "Docker containers:" |
| 120 | + docker ps -a |
| 121 | + } > logs/system-info.log 2>&1 |
| 122 | +
|
| 123 | + - name: Upload logs as artifacts |
| 124 | + if: always() |
| 125 | + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 |
| 126 | + with: |
| 127 | + name: ci-logs-${{ github.sha }} |
| 128 | + path: logs/ |
| 129 | + retention-days: 7 |
| 130 | + |
| 131 | + - name: Cleanup vllm containers |
| 132 | + if: always() |
| 133 | + shell: bash |
| 134 | + run: | |
| 135 | + docker rm -f vllm-inference vllm-embedding |
| 136 | +
|
| 137 | + - name: Log in to Quay.io |
| 138 | + id: login |
| 139 | + if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) |
| 140 | + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 |
| 141 | + with: |
| 142 | + registry: ${{ env.REGISTRY }} |
| 143 | + username: ${{ secrets.QUAY_USERNAME }} |
| 144 | + password: ${{ secrets.QUAY_PASSWORD }} |
| 145 | + |
| 146 | + - name: Publish image to Quay.io |
| 147 | + id: publish |
| 148 | + if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) |
| 149 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 |
| 150 | + with: |
| 151 | + context: . |
| 152 | + file: vllm/Containerfile |
| 153 | + platforms: ${{ matrix.platform }} |
| 154 | + push: true |
| 155 | + tags: ${{ env.IMAGE_NAME }}:${{ env.INFERENCE_TAG }}-${{ env.EMBEDDING_TAG }} |
| 156 | + build-args: | |
| 157 | + INFERENCE_MODEL=${{ env.INFERENCE_MODEL }} |
| 158 | + EMBEDDING_MODEL=${{ env.EMBEDDING_MODEL }} |
0 commit comments