-
Notifications
You must be signed in to change notification settings - Fork 5.9k
fix: make argocd login respect the context name #22643
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
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
relates to #19867 which will hopefully make this all the more complete |
The test failed performing a git operation unrelated to my change. |
The argocd CLI login command does not respect the --argocd-context flag to name the context and always uses the name of the server. This makes it respect the flag and use the supplied context name. Removed check against empty ctxName which is done higher up already. Signed-off-by: Doug Goldstein <[email protected]>
c3cc140
to
e6d0957
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22643 +/- ##
==========================================
- Coverage 56.06% 56.05% -0.01%
==========================================
Files 343 343
Lines 57536 57535 -1
==========================================
- Hits 32257 32254 -3
- Misses 22634 22641 +7
+ Partials 2645 2640 -5 ☔ View full report in Codecov by Sentry. |
The entire function where I made the change is uncovered. |
@@ -112,6 +112,8 @@ argocd login cd.argoproj.io --core`, | |||
ServerName: globalClientOpts.ServerName, | |||
} | |||
|
|||
ctxName = globalClientOpts.Context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctxName = globalClientOpts.Context | |
ctxName = globalClientOpts.Context |
why is this required? Shouldn't we get the ctxName
value automatically from the flag itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That global option is the flag where it's being read from. If it's not supplied then it's created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nitishfy So today if you run argocd login argocd.my.host --sso --argocd-context my-argocd
the context that gets created is called argocd.my.host
and the option is ignored. The code path today sets the ctxName
variable equal to the server name if its unset (which is always is). Then it performs some additional transformations on the ctxName
variable. What I did was just default the ctxName
to the command line flag in this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for setting the ctx, you can simply use the --name
flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhhh derp on my part @nitishfy.
The argocd CLI login command does not respect the --argocd-context flag to name the context and always uses the name of the server. This makes it respect the flag and use the supplied context name. Removed check against empty ctxName which is done higher up already.
Checklist: