* 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: hongming <coder.scala@gmail.com>
23 lines
471 B
Go
23 lines
471 B
Go
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())
|
|
}
|