helmfile icon indicating copy to clipboard operation
helmfile copied to clipboard

gitconfig beeing ignored since 0.143.1

Open carnei-ro opened this issue 3 years ago • 4 comments

Hey, I have this:

helmfiles:
  - path: git::https://github.com/carnei-ro/packages.git@my-awesome-package/helmfile.yaml?ref=v0.1.0

https://github.com/carnei-ro/packages.git is a private repository, so, I have in my .gitconfig

[url "https://[email protected]"]
  insteadOf = https://github.com

When using the version 0.143.0 everything works, but when I try to use 0.143.1 and beyond it asks me for GitHub credentials :hankey: .

carnei-ro avatar Mar 30 '22 18:03 carnei-ro

@carnei-ro Hey! I'm still unsure if this is an issue in Helmfile.

Here's the full diff between v0.143.0 and v0.143.1

https://github.com/roboll/helmfile/compare/v0.143.0...v0.143.1

You'll see no changes related to how we handle those git::https resources. More concretely, we use https://github.com/hashicorp/go-getter for handling those sources but there's no change in that dependency. Just curious, but are the environments you run helmfile v0.143.0 and v0.143.1 are same?

mumoshu avatar Mar 30 '22 23:03 mumoshu

@carnei-ro I suspect that there is a problem with work directory movement in 0.143.1 and later versions. I am also suffering from a different event (#2118) than this case.

I do not use private repositories, so the following information is for reference only.

When go-getter works with 0.143.0, the Home directory is " . ". That means "/helmfile.d". But in later versions, the Home directory is shown as "/root/.cache/helmfile". I am working as root user, so it is "/root/", which means "~".

  • v0.143.0 helmfile --debug apply
processing file "helmfile.yaml" in directory "helmfile.d"                                          
changing working directory to "/helmfile.d"

... snip ...

getter: git
scheme: https
user:
host: github.com
dir: /argoproj/argo-helm.git
file: charts/argo-cd/crds
home: .
getter dest: .helmfile/cache/argo-cd-crds/https_github_com_argoproj_argo-helm_git
cached dir: .helmfile/cache/argo-cd-crds/https_github_com_argoproj_argo-helm_git
  • 0.143.1 and later helmfile --debug apply
...snip...

getter: git
scheme: https
user:
host: github.com
dir: /argoproj/argo-helm.git
file: charts/argo-cd/crds
home: /root/.cache/helmfile
getter dest: argo-cd-crds/https_github_com_argoproj_argo-helm_git
cached dir: /root/.cache/helmfile/argo-cd-crds/https_github_com_argoproj_argo-helm_git

Is the .gitconfig in the same directory where the helmfile.yaml is located? If so, would moving .gitconfig to "~/.cache/helmfile/" work correctly? If that solves the problem, it is probably a bug related to the directory move.

chattytak avatar Mar 31 '22 03:03 chattytak

In my case, I'm using remote charts, but not remote helmfiles,

helmfile.yaml

releases:
- chart: git::https://gitlab.com/xxx

locally I have

git config --global -l | grep gitlab.com | grep url.https
url.https://gitlab-ci-token:[email protected]/xxx.insteadof=https://gitlab.com/xxx

on CI, I use

.git_configure: &git_configure
  - git config --global credential.helper store
  - echo "https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com" > ~/.git-credentials

I tried to make a helmfile which source my current helmfile, everything seems fine

helmfile --debug template
helmfiles:
- path: git::https://gitlab.com/xxx/devops/k8s.git@app/helmfile.yaml?ref=main
getter: git
scheme: https
user:
host: gitlab.com
dir: /xxx/devops/k8s.git
file: app/helmfile.yaml
home: C:\Users\minhq\AppData\Local\helmfile
getter dest: https_gitlab_com_xxx_devops_k8s_git.ref=main
cached dir: C:\Users\minhq\AppData\Local\helmfile\https_gitlab_com_xxx_devops_k8s_git.ref=main
downloading git::https://gitlab.com/xxx/devops/k8s.git?ref=main to https_gitlab_com_xxx_devops_k8s_git.ref=main
helmfile cache info
Cache directory: C:\Users\minhq\AppData\Local\helmfile
- https_gitlab_com_xxx_devops_k8s_git.ref=main

itscaro avatar Apr 05 '22 21:04 itscaro

@carnei-ro, @chattytak could you share the output of this command without any sensitive data please?

git config --global -l | grep -e credential -e url.https

itscaro avatar Apr 05 '22 21:04 itscaro