[release-4.1] feat: Adapt to oci-based helmchart repo (#6203)

* add oci client for registry

* add LoadRepoIndexFormOci

* feat: Adapt to oci-based helmchart repo

* Update the golang base image version in the dockerfile

* update oci_test.go

Signed-off-by: lingbo <lingbo@lingbohome.com>

* fix: Update oci_test.go

Signed-off-by: 凌波 <lingbo@lingbohome.com>

* Update go imports

---------

Signed-off-by: lingbo <lingbo@lingbohome.com>
Signed-off-by: 凌波 <lingbo@lingbohome.com>
Co-authored-by: lingbo <lingbo@lingbohome.com>
Co-authored-by: hongming <coder.scala@gmail.com>
This commit is contained in:
KubeSphere CI Bot
2024-09-25 11:02:16 +08:00
committed by GitHub
parent 88db498bcd
commit 7e703750e8
12 changed files with 727 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
package oci
import (
"fmt"
"oras.land/oras-go/pkg/registry"
)
func buildScheme(plainHTTP bool) string {
if plainHTTP {
return "http"
}
return "https"
}
func buildRegistryBaseURL(plainHTTP bool, ref registry.Reference) string {
return fmt.Sprintf("%s://%s/v2/", buildScheme(plainHTTP), ref.Host())
}
func buildRegistryCatalogURL(plainHTTP bool, ref registry.Reference) string {
return fmt.Sprintf("%s://%s/v2/_catalog", buildScheme(plainHTTP), ref.Host())
}