From b2bf7c1dfbbe511869e7acecb97802f1baea0ede Mon Sep 17 00:00:00 2001 From: Nitish Agarwal <1592163+nitishagar@users.noreply.github.com> Date: Tue, 24 Mar 2026 14:18:48 +0530 Subject: [PATCH] hack: fix amd-gpu-device-plugin update script version tag mismatch The GitHub release tag (e.g. v1.25.2) differs from the Docker Hub image tag (e.g. v1.25.2.8). Update the script to find the correct image tag by querying available tags that match the release version prefix. --- .../amd_device_gpu_plugin_version.go | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/hack/update/amd_device_gpu_plugin_version/amd_device_gpu_plugin_version.go b/hack/update/amd_device_gpu_plugin_version/amd_device_gpu_plugin_version.go index 6251973396..f5c84ebf0a 100644 --- a/hack/update/amd_device_gpu_plugin_version/amd_device_gpu_plugin_version.go +++ b/hack/update/amd_device_gpu_plugin_version/amd_device_gpu_plugin_version.go @@ -19,6 +19,7 @@ package main import ( "context" "fmt" + "strings" "time" "k8s.io/minikube/hack/update" @@ -39,6 +40,19 @@ type Data struct { SHA string } +// findMatchingImageTag finds the Docker Hub image tag corresponding to a GitHub release tag. +// Docker Hub tags may include a numeric patch suffix not present in the GitHub release tag +// (e.g. GitHub "v1.25.2" may correspond to Docker Hub "v1.25.2.8"). +// Tags should be provided newest-first (Docker Hub API default); the first match is returned. +func findMatchingImageTag(tags []string, ghTag string) (string, error) { + for _, tag := range tags { + if tag == ghTag || strings.HasPrefix(tag, ghTag+".") { + return tag, nil + } + } + return "", fmt.Errorf("no Docker Hub image tag found matching GitHub release tag %s", ghTag) +} + func main() { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() @@ -47,12 +61,23 @@ func main() { if err != nil { klog.Fatalf("Unable to get stable version: %v", err) } - sha, err := update.GetImageSHA(fmt.Sprintf("rocm/k8s-device-plugin:%s", stable.Tag)) + + dockerTags, err := update.ImageTagsFromDockerHub("rocm/k8s-device-plugin") + if err != nil { + klog.Fatalf("failed to get Docker Hub tags for rocm/k8s-device-plugin: %v", err) + } + + imageTag, err := findMatchingImageTag(dockerTags, stable.Tag) + if err != nil { + klog.Fatalf("failed to find Docker Hub image tag matching GitHub release tag %s: %v", stable.Tag, err) + } + + sha, err := update.GetImageSHA(fmt.Sprintf("rocm/k8s-device-plugin:%s", imageTag)) if err != nil { klog.Fatalf("failed to get image SHA: %v", err) } - data := Data{Version: stable.Tag, SHA: sha} + data := Data{Version: imageTag, SHA: sha} if err := update.Apply(schema, data); err != nil { klog.Fatalf("unable to apply update: %v", err)