Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argo cli should not use os.Getenv("HOME") to find kubeconfig #12850

Closed
rouke-broersma opened this issue Mar 14, 2023 · 4 comments · Fixed by #14325
Closed

argo cli should not use os.Getenv("HOME") to find kubeconfig #12850

rouke-broersma opened this issue Mar 14, 2023 · 4 comments · Fixed by #14325
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rouke-broersma
Copy link
Contributor

https://github.com/argoproj/argo-cd/blob/ab754052c8f01b90c63f0ef0fe6a2632652969c6/pkg/apis/application/v1alpha1/types.go#LL2571C2-L2571C2

The HOME environment variable is not used on all platforms so is not a good cross-platform solution for finding the home dir. I suggest using https://pkg.go.dev/os#UserHomeDir instead. Am I missing something or is this something I could easily contribute?

I found this because of: https://cloud-native.slack.com/archives/C01TSERG0KZ/p1678778975672349

Please let me now if there's something else going on that make this not an actual problem, or if there's anything I should be mindful of when implementing the improvement.

@blakepettersson
Copy link
Member

It sounds like a reasonable change IMO, we'd just need to be mindful not to accidentally break anything. From what I can see the only place it's used in the CLI is in cluster.go

@todaywasawesome todaywasawesome added good first issue Good for newcomers enhancement New feature or request labels Jun 28, 2023
@todaywasawesome
Copy link
Contributor

@rouke-broersma Are you going to make a PR?

@rouke-broersma
Copy link
Contributor Author

@rouke-broersma Are you going to make a PR?

Hi sorry completely forgot about this. I'm interested in doing this but not sure I can commit to it in the short term. I'll add it to the list in case no one else has picked it up by the time I get there 😅

@aynp
Copy link
Contributor

aynp commented Jul 3, 2023

Was a pretty small change, opened a PR for it #14325. Also changed one other location where it was being used.

jannfis pushed a commit that referenced this issue Jul 10, 2023
…14325)

* Replace `os.Getenv("HOME")` with `os.UserHomeDir()`

`os.UserHomeDir()` is the recommended way of getting user home directory

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>

* Retrigger CI pipeline

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>

---------

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>
yyzxw pushed a commit to yyzxw/argo-cd that referenced this issue Aug 9, 2023
…12850) (argoproj#14325)

* Replace `os.Getenv("HOME")` with `os.UserHomeDir()`

`os.UserHomeDir()` is the recommended way of getting user home directory

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>

* Retrigger CI pipeline

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>

---------

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>
tesla59 pushed a commit to tesla59/argo-cd that referenced this issue Dec 16, 2023
…12850) (argoproj#14325)

* Replace `os.Getenv("HOME")` with `os.UserHomeDir()`

`os.UserHomeDir()` is the recommended way of getting user home directory

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>

* Retrigger CI pipeline

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>

---------

Signed-off-by: Aryan Pathania <cont-a-pathania@mercari.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants