Skip to content

Commit e6d0957

Browse files
committed
fix: make argocd login respect the context name
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]>
1 parent 127eef9 commit e6d0957

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cmd/argocd/commands/login.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ argocd login cd.argoproj.io --core`,
112112
ServerName: globalClientOpts.ServerName,
113113
}
114114

115+
ctxName = globalClientOpts.Context
116+
115117
if ctxName == "" {
116118
ctxName = server
117119
if globalClientOpts.GRPCWebRootPath != "" {
@@ -167,9 +169,6 @@ argocd login cd.argoproj.io --core`,
167169
AuthToken: tokenString,
168170
RefreshToken: refreshToken,
169171
})
170-
if ctxName == "" {
171-
ctxName = server
172-
}
173172
localCfg.CurrentContext = ctxName
174173
localCfg.UpsertContext(localconfig.ContextRef{
175174
Name: ctxName,

0 commit comments

Comments
 (0)