|
| 1 | +# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: GPU Snapshot and Validate |
| 16 | +description: Run aicr snapshot and validate GPU detection |
| 17 | + |
| 18 | +inputs: |
| 19 | + gpu_model: |
| 20 | + description: 'Expected GPU model substring (e.g., T4, H100)' |
| 21 | + required: true |
| 22 | + min_gpu_count: |
| 23 | + description: 'Minimum expected GPU count' |
| 24 | + required: true |
| 25 | + default: '1' |
| 26 | + cluster_name: |
| 27 | + description: 'Kind cluster name (for kubectl context)' |
| 28 | + required: true |
| 29 | + |
| 30 | +runs: |
| 31 | + using: composite |
| 32 | + steps: |
| 33 | + - name: Run aicr snapshot |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + ./aicr snapshot --deploy-agent \ |
| 37 | + --kubeconfig="${HOME}/.kube/config" \ |
| 38 | + --namespace=default \ |
| 39 | + --image=ko.local:smoke-test \ |
| 40 | + --require-gpu \ |
| 41 | + --output=snapshot.yaml |
| 42 | + echo "--- Snapshot output ---" |
| 43 | + cat snapshot.yaml |
| 44 | +
|
| 45 | + - name: Validate snapshot detected GPU |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + GPU_MODEL=$(yq eval '.measurements[] | select(.type == "GPU") | .subtypes[0].data["gpu.model"]' snapshot.yaml) |
| 49 | + GPU_COUNT=$(yq eval '.measurements[] | select(.type == "GPU") | .subtypes[0].data["gpu-count"]' snapshot.yaml) |
| 50 | + echo "GPU model: ${GPU_MODEL}" |
| 51 | + echo "GPU count: ${GPU_COUNT}" |
| 52 | + if [[ "${GPU_MODEL}" != *"${{ inputs.gpu_model }}"* ]]; then |
| 53 | + echo "::error::Expected ${{ inputs.gpu_model }} GPU in snapshot, got: ${GPU_MODEL}" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | + if [[ "${GPU_COUNT}" -lt ${{ inputs.min_gpu_count }} ]]; then |
| 57 | + echo "::error::Expected gpu-count >= ${{ inputs.min_gpu_count }}, got: ${GPU_COUNT}" |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | + echo "Snapshot correctly detected ${GPU_COUNT}x ${GPU_MODEL}" |
0 commit comments