Merge pull request #13499 from gjenkins8/shadow_oras_remoteclient_type

Shadow ORAS remote.Client interface
pull/13510/head
Matt Farina 10 months ago committed by GitHub
commit a1af40621a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -51,6 +51,13 @@ an underscore (_) in chart version tags when pushing to a registry and back to
a plus (+) when pulling from a registry.` a plus (+) when pulling from a registry.`
type ( type (
// RemoteClient shadows the ORAS remote.Client interface
// (hiding the ORAS type from Helm client visibility)
// https://pkg.go.dev/oras.land/oras-go/pkg/registry/remote#Client
RemoteClient interface {
Do(req *http.Request) (*http.Response, error)
}
// Client works with OCI-compliant registries // Client works with OCI-compliant registries
Client struct { Client struct {
debug bool debug bool
@ -61,7 +68,7 @@ type (
password string password string
out io.Writer out io.Writer
authorizer auth.Client authorizer auth.Client
registryAuthorizer *registryauth.Client registryAuthorizer RemoteClient
resolver func(ref registry.Reference) (remotes.Resolver, error) resolver func(ref registry.Reference) (remotes.Resolver, error)
httpClient *http.Client httpClient *http.Client
plainHTTP bool plainHTTP bool
@ -220,7 +227,7 @@ func ClientOptAuthorizer(authorizer auth.Client) ClientOption {
// can be used to override the default authorization mechanism. // can be used to override the default authorization mechanism.
// //
// Depending on the use-case you may need to set both ClientOptAuthorizer and ClientOptRegistryAuthorizer. // Depending on the use-case you may need to set both ClientOptAuthorizer and ClientOptRegistryAuthorizer.
func ClientOptRegistryAuthorizer(registryAuthorizer *registryauth.Client) ClientOption { func ClientOptRegistryAuthorizer(registryAuthorizer RemoteClient) ClientOption {
return func(client *Client) { return func(client *Client) {
client.registryAuthorizer = registryAuthorizer client.registryAuthorizer = registryAuthorizer
} }

Loading…
Cancel
Save