use version.GetUserAgent

Signed-off-by: Josh Dolitsky <josh@dolit.ski>
pull/9782/head
Josh Dolitsky 4 years ago
parent 31588e7908
commit faf7fc5efd
No known key found for this signature in database
GPG Key ID: B2B93673243A65FB

@ -17,7 +17,6 @@ limitations under the License.
package registry // import "helm.sh/helm/v3/internal/experimental/registry"
import (
"fmt"
"io"
"io/ioutil"
"net/http"
@ -30,8 +29,6 @@ import (
"helm.sh/helm/v3/pkg/helmpath"
)
var userAgent = fmt.Sprintf("helm/%s", version.GetVersion())
type (
// Client works with OCI-compliant registries
Client struct {
@ -64,7 +61,7 @@ func NewClient(options ...ClientOption) (*Client, error) {
}
if client.resolver == nil {
headers := http.Header{}
headers.Set("User-Agent", userAgent)
headers.Set("User-Agent", version.GetUserAgent())
opts := []auth.ResolverOption{auth.WithResolverHeaders(headers)}
resolver, err := client.authorizer.ResolverWithOpts(opts...)
if err != nil {

@ -20,6 +20,8 @@ import (
"fmt"
"oras.land/oras-go/pkg/auth"
"helm.sh/helm/v3/internal/version"
)
// Login logs into a registry
@ -33,7 +35,7 @@ func (c *Client) Login(host string, options ...LoginOption) (*LoginResult, error
auth.WithLoginHostname(host),
auth.WithLoginUsername(operation.username),
auth.WithLoginSecret(operation.password),
auth.WithLoginUserAgent(userAgent),
auth.WithLoginUserAgent(version.GetUserAgent()),
}
if operation.insecure {
authorizerLoginOpts = append(authorizerLoginOpts, auth.WithLoginInsecure())

Loading…
Cancel
Save