Skip to content

Commit

Permalink
Merge pull request #6541 from lzhecheng/cp-6528-r-1.30
Browse files Browse the repository at this point in the history
[release-1.30][e2e] Replace dockerhub with MCR for nginx image
  • Loading branch information
k8s-ci-robot authored Jul 8, 2024
2 parents 7b600a8 + 683357e commit 0576e1a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/e2e/utils/container_registry_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0576e1a

Please sign in to comment.