From 683357e35e88d3babe3a42df21e0811b4e8a94f7 Mon Sep 17 00:00:00 2001 From: Zhecheng Li Date: Fri, 5 Jul 2024 08:24:07 +0000 Subject: [PATCH] [e2e] Replace dockerhub with MCR for nginx image Signed-off-by: Zhecheng Li --- tests/e2e/utils/container_registry_utils.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/e2e/utils/container_registry_utils.go b/tests/e2e/utils/container_registry_utils.go index 113ca04b8d..18760d912f 100644 --- a/tests/e2e/utils/container_registry_utils.go +++ b/tests/e2e/utils/container_registry_utils.go @@ -107,26 +107,27 @@ func AZACRLogin() (err error) { return nil } -// PushImageToACR pull an image from Docker Hub and push +// PushImageToACR pull an image from MCR and push // it to the given azure container registry func (tc *AzureTestClient) PushImageToACR(registryName, image string) (string, error) { acrClient := tc.createACRClient() rgName := tc.GetResourceGroup() + tag := "1.25" err := acrClient.ImportImage(context.Background(), rgName, registryName, acr.ImportImageParameters{ Source: &acr.ImportSource{ - RegistryURI: pointer.String("docker.io"), - SourceImage: pointer.String("library/" + image + ":latest"), + RegistryURI: pointer.String("mcr.microsoft.com"), + SourceImage: pointer.String("mirror/docker/library/" + image + ":" + tag), }, TargetTags: []*string{ - to.Ptr(image + ":latest"), + to.Ptr(image + ":" + tag), }, Mode: to.Ptr(acr.ImportModeNoForce), }) if err != nil { - return "", fmt.Errorf("failed to import image %s from docker hub to acr %s with error: %w", image, registryName, err) + return "", fmt.Errorf("failed to import image %s from MCR to acr %s with error: %w", image, registryName, err) } - return "latest", nil + return tag, nil } // AZACRCacheCreate enables acr cache for a image.