aslafy-z / helm-git

Helm Plugin - Install Helm Charts strait from Git repositories
Apache License 2.0
287 stars 46 forks source link

Feature: Support helm --username --password #255

Open Exchizz opened 1 year ago

Exchizz commented 1 year ago

Hi,

I'm currently looking into using helm-git from ArgoCD. ArgoCD passes credentials to helm repositories using "helm repo add --username and --password). Currently helm-git does not support using credentials passed via helm repo add --username and --password

I think it would be possible to support using something like:

git -c credential.helper='!f() { sleep 1; echo "username=${GIT_USER}"; echo "password=${GIT_PASSWORD}"; }; f' pull

(Copied from https://stackoverflow.com/a/65705346/1493471)

If I managed to implement this in helm-git, would this be merged in ?

\Mathias

aslafy-z commented 1 year ago

Hello,

AFAIK, Helm does not forward these credentials to downloader plugins. If you find a way to do so, I'm pretty sure we can merge that to helm-git.

These bindings has to be made manually either in the URL like git+https://username:password@host/... (for HTTP/S endpoints) or using a credential helper as stated in https://github.com/aslafy-z/helm-git#note-on-git-authentication.

If you're using ArgoCD and reference this Helm chart within the Application CR, you don't need to use this plugin as you can directly reference Helm sources files and link credentials.

Let me know if you need additional details

Exchizz commented 1 year ago

Hi, I've created a PR that implements support for helm to pass --username and --password to download plugins. https://github.com/helm/helm/pull/11878

If it gets merged in I will make a pull request to helm-git that supports either git credentials helper or your approach with username:password :)

Thanks.

vl-kp commented 1 year ago

but argocd only support http, i would like to use git+ssh

aslafy-z commented 1 year ago

@vl-kp I'm pretty sure ArgoCD supports working with Git over SSH

vl-kp commented 1 year ago

I want the valueFiles to support git over ssh, currently only http+https, i made it works after add id_rsa, but it doesn't full support my initial goal, anyway thanks for the answer

And i found helm-git doesn't support .. in the path, not sure if this should be supported

aslafy-z commented 3 months ago

@Exchizz I've seen https://github.com/helm/helm/pull/11878 was merged. I'd be welcomed to review a PR that implements support for it in helm-git :+1: