Skip to content

Commit 8598986

Browse files
goingforstudying-ctrlgoingforstudying-ctrl
andauthored
feat(helm): set User-Agent when downloading Helm repo index.yaml (kubevela#7162)
Signed-off-by: goingforstudying-ctrl <goingforstudying@gmail.com> Co-authored-by: goingforstudying-ctrl <goingforstudying@ctrl.com>
1 parent 24ae77d commit 8598986

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pkg/utils/helm/repo_index.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import (
2727
"helm.sh/helm/v3/pkg/getter"
2828
helmrepo "helm.sh/helm/v3/pkg/repo"
2929
"sigs.k8s.io/yaml"
30+
31+
"github.com/oam-dev/kubevela/apis/types"
32+
"github.com/oam-dev/kubevela/version"
3033
)
3134

3235
// IndexYaml is the index.yaml of helm repo
@@ -67,9 +70,10 @@ func loadData(u string, cred *RepoCredential) (*bytes.Buffer, error) {
6770
}
6871

6972
indexURL := parsedURL.String()
70-
// TODO add user-agent
73+
userAgent := types.KubeVelaName + "/" + version.GitRevision
7174
g, _ := getter.NewHTTPGetter()
7275
resp, err = g.Get(indexURL,
76+
getter.WithUserAgent(userAgent),
7377
getter.WithTimeout(5*time.Minute),
7478
getter.WithURL(u),
7579
getter.WithInsecureSkipVerifyTLS(skipTLS),

0 commit comments

Comments
 (0)