Skip to content

Commit 652724d

Browse files
Merge pull request #1884 from ArangoGutierrez/integration-tests
Add weekly forward compatibility testing
2 parents d5750f2 + 340dcd1 commit 652724d

16 files changed

Lines changed: 1444 additions & 426 deletions
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright NVIDIA CORPORATION
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+
# http://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+
# Usage: generate-values-overrides.sh OUTPUT_FILE TOOLKIT_IMAGE DEVICE_PLUGIN_IMAGE MIG_MANAGER_IMAGE
20+
#
21+
# Generates a Helm values override file for GPU Operator component images.
22+
# This file can be used with `helm install -f values-overrides.yaml` to
23+
# override default component image versions.
24+
25+
if [[ $# -ne 4 ]]; then
26+
echo "Usage: $0 OUTPUT_FILE TOOLKIT_IMAGE DEVICE_PLUGIN_IMAGE MIG_MANAGER_IMAGE" >&2
27+
echo "" >&2
28+
echo "Example:" >&2
29+
echo " $0 values.yaml \\" >&2
30+
echo " ghcr.io/nvidia/container-toolkit:v1.18.0-ubuntu20.04 \\" >&2
31+
echo " ghcr.io/nvidia/k8s-device-plugin:v0.17.0-ubi8 \\" >&2
32+
echo " ghcr.io/nvidia/k8s-mig-manager:v0.10.0-ubuntu20.04" >&2
33+
exit 1
34+
fi
35+
36+
OUTPUT_FILE="$1"
37+
TOOLKIT_IMAGE="$2"
38+
DEVICE_PLUGIN_IMAGE="$3"
39+
MIG_MANAGER_IMAGE="$4"
40+
41+
# Generate values override file
42+
cat > "${OUTPUT_FILE}" <<EOF
43+
# Generated by generate-values-overrides.sh
44+
#
45+
# This file overrides default GPU Operator component images with
46+
# specific versions for forward compatibility testing.
47+
48+
toolkit:
49+
repository: ""
50+
version: ""
51+
image: "${TOOLKIT_IMAGE}"
52+
53+
devicePlugin:
54+
repository: ""
55+
version: ""
56+
image: "${DEVICE_PLUGIN_IMAGE}"
57+
58+
migManager:
59+
repository: ""
60+
version: ""
61+
image: "${MIG_MANAGER_IMAGE}"
62+
EOF
63+
64+
echo "Generated values override file: ${OUTPUT_FILE}"
65+
echo ""
66+
echo "=== Component Images ==="
67+
echo "Container Toolkit: ${TOOLKIT_IMAGE}"
68+
echo "Device Plugin: ${DEVICE_PLUGIN_IMAGE}"
69+
echo "MIG Manager: ${MIG_MANAGER_IMAGE}"
70+
echo ""
71+
echo "=== File Contents ==="
72+
cat "${OUTPUT_FILE}"
73+
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/usr/bin/env bash
2+
# Copyright NVIDIA CORPORATION
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -euo pipefail
17+
18+
COMPONENT=${1:-}
19+
20+
if [[ -z "${COMPONENT}" ]]; then
21+
echo "Usage: $0 <toolkit|device-plugin|mig-manager>" >&2
22+
exit 1
23+
fi
24+
25+
# Verify regctl is available
26+
if ! command -v regctl &> /dev/null; then
27+
echo "Error: regctl not found. Please install regctl first." >&2
28+
exit 1
29+
fi
30+
31+
# Map component names to GHCR image repositories and GitHub source repositories
32+
case "${COMPONENT}" in
33+
toolkit)
34+
IMAGE_REPO="ghcr.io/nvidia/container-toolkit"
35+
GITHUB_REPO="NVIDIA/nvidia-container-toolkit"
36+
;;
37+
device-plugin)
38+
IMAGE_REPO="ghcr.io/nvidia/k8s-device-plugin"
39+
GITHUB_REPO="NVIDIA/k8s-device-plugin"
40+
;;
41+
mig-manager)
42+
IMAGE_REPO="ghcr.io/nvidia/k8s-mig-manager"
43+
GITHUB_REPO="NVIDIA/mig-parted"
44+
;;
45+
*)
46+
echo "Error: Unknown component '${COMPONENT}'" >&2
47+
echo "Valid components: toolkit, device-plugin, mig-manager" >&2
48+
exit 1
49+
;;
50+
esac
51+
52+
echo "Fetching latest commit from ${GITHUB_REPO}..." >&2
53+
54+
# Get the latest commit SHA from the main branch using GitHub API.
55+
# NOTE: We use 8-char truncated SHAs as image tags. This must match the
56+
# tag convention used by each component's CI pipeline when publishing images.
57+
GITHUB_API_URL="https://api.github.com/repos/${GITHUB_REPO}/commits/main"
58+
59+
# Use GITHUB_TOKEN if available for authentication (higher rate limits)
60+
if [[ -n "${GITHUB_TOKEN:-}" ]]; then
61+
LATEST_COMMIT=$(curl -sSL \
62+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
63+
-H "Accept: application/vnd.github.v3+json" \
64+
"${GITHUB_API_URL}" | \
65+
jq -r '.sha[0:8]')
66+
else
67+
LATEST_COMMIT=$(curl -sSL \
68+
-H "Accept: application/vnd.github.v3+json" \
69+
"${GITHUB_API_URL}" | \
70+
jq -r '.sha[0:8]')
71+
fi
72+
73+
if [[ -z "${LATEST_COMMIT}" || "${LATEST_COMMIT}" == "null" ]]; then
74+
echo "Error: Failed to fetch latest commit from ${GITHUB_REPO}" >&2
75+
exit 1
76+
fi
77+
78+
echo "Latest commit SHA: ${LATEST_COMMIT}" >&2
79+
80+
# Construct full image path with commit tag
81+
FULL_IMAGE="${IMAGE_REPO}:${LATEST_COMMIT}"
82+
83+
echo "Verifying image exists: ${FULL_IMAGE}" >&2
84+
85+
# Verify the image exists using regctl with retry
86+
MAX_RETRIES=5
87+
RETRY_DELAY=30
88+
for i in $(seq 1 ${MAX_RETRIES}); do
89+
if regctl manifest head "${FULL_IMAGE}" &> /dev/null; then
90+
echo "Verified ${COMPONENT} image: ${FULL_IMAGE}" >&2
91+
echo "${FULL_IMAGE}"
92+
exit 0
93+
fi
94+
95+
if [[ $i -lt ${MAX_RETRIES} ]]; then
96+
echo "Image not found (attempt $i/${MAX_RETRIES}), waiting ${RETRY_DELAY}s for CI to build..." >&2
97+
sleep ${RETRY_DELAY}
98+
# Exponential backoff: 30s, 60s, 120s, 240s
99+
RETRY_DELAY=$((RETRY_DELAY * 2))
100+
fi
101+
done
102+
103+
echo "Error: Image ${FULL_IMAGE} does not exist after ${MAX_RETRIES} attempts" >&2
104+
echo "The image may not have been built yet for commit ${LATEST_COMMIT}" >&2
105+
exit 1

0 commit comments

Comments
 (0)