|
| 1 | +#!/usr/bin/env bash |
| 2 | +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -euo pipefail |
| 18 | + |
| 19 | +repo_root="$(cd "$(dirname "$0")/.." && pwd)" |
| 20 | +workspace_root="$(cd "${repo_root}/../../.." && pwd)" |
| 21 | +tmp_dir="$(mktemp -d)" |
| 22 | +fixture_root="${tmp_dir}/fixture" |
| 23 | + |
| 24 | +cleanup() { |
| 25 | + rm -rf "${tmp_dir}" |
| 26 | +} |
| 27 | +trap cleanup EXIT |
| 28 | + |
| 29 | +mkdir -p "${fixture_root}/deploy/helm" |
| 30 | +cp -R "${repo_root}" "${fixture_root}/deploy/helm/nvca-operator" |
| 31 | +mkdir -p "${fixture_root}/src/compute-plane-services/nvca/deployments" |
| 32 | +cp -R "${workspace_root}/src/compute-plane-services/nvca/deployments/nvca-operator" \ |
| 33 | + "${fixture_root}/src/compute-plane-services/nvca/deployments/nvca-operator" |
| 34 | + |
| 35 | +chart_root="${fixture_root}/deploy/helm/nvca-operator" |
| 36 | +NVCA_OPERATOR_VERSION="3.2.11" \ |
| 37 | +NVCA_VERSION="3.2.11" \ |
| 38 | +NVCA_SHARED_STORAGE_IMAGE_TAG="1.0.5" \ |
| 39 | + "${chart_root}/scripts/ci_vendor_nvca_operator_chart" >/dev/null |
| 40 | + |
| 41 | +actual_tag="$(yq -r '.image.tag' "${chart_root}/nvca-operator/values.yaml")" |
| 42 | +if [[ -n "${actual_tag}" ]]; then |
| 43 | + echo "expected vendored image.tag to remain empty, got ${actual_tag}" >&2 |
| 44 | + exit 1 |
| 45 | +fi |
| 46 | + |
| 47 | +yq eval -i '.version = "3.2.11"' "${chart_root}/nvca-operator/Chart.yaml" |
| 48 | +manifest="${tmp_dir}/manifest.yaml" |
| 49 | +helm template nvca-operator "${chart_root}/nvca-operator" \ |
| 50 | + --set-string image.repository=registry.example.test/nvca-operator \ |
| 51 | + --set-string selfManaged.icmsServiceURL=http://icms.example.invalid:8080 \ |
| 52 | + --set-string selfManaged.revalServiceURL=http://reval.example.invalid:8080 \ |
| 53 | + --set-string selfManaged.natsURL=nats://nats.example.invalid:4222 \ |
| 54 | + > "${manifest}" |
| 55 | + |
| 56 | +if ! grep -Fq 'image: registry.example.test/nvca-operator:3.2.11' "${manifest}"; then |
| 57 | + echo "expected image.tag to fall back to the chart version" >&2 |
| 58 | + exit 1 |
| 59 | +fi |
| 60 | + |
| 61 | +echo "vendor_chart_image_tag_test.sh keeps image.tag empty for chart-version fallback" |
0 commit comments