-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat(cli): add argocd context subcommands
#25077
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
base: master
Are you sure you want to change the base?
feat(cli): add argocd context subcommands
#25077
Conversation
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
|
/component cli |
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
| # Switch Argo CD context | ||
| argocd context cd.argoproj.io | ||
| argocd context switch cd.argoproj.io |
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.
how about argocd context use?
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.
If I'm not wrong, the switch command does exactly the same as use command, do you mean to change the name of the command from switch to be use?
If this is not what you mean, can you tell me the difference between them?
| err := deleteContext(args[0], clientOpts.ConfigPath) | ||
| errors.CheckError(err) | ||
| return | ||
| func NewContextListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { |
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.
| func NewContextListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { | |
| // NewContextListCommand lists the contexts | |
| func NewContextListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { |
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.
Do you think we should to stick to the function comments format in app and login (i.e. https://github.com/argoproj/argo-cd/blob/master/cmd/argocd/commands/app.go#L124)
or apply your change and make the comment more meaningful (Anyway I see that the usage of that commands make it clear anyway) but I'd wait for your answer
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.
Thank you for the PR. The code looks good to me. Here are few suggestions:
- Please write comments in the code wherever required, eg. in the code for switch command.
- Write unit tests for the utility functions.
- You'll be required to run codegen to update the docs too.
util/localconfig/localconfig.go
Outdated
| return false | ||
| } | ||
|
|
||
| func (l *LocalConfig) GetContext(ctxName string) (*ContextRef, error) { |
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.
please write unit tests.
Co-authored-by: Nitish Kumar <justnitish06@gmail.com> Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #25077 +/- ##
==========================================
+ Coverage 60.83% 62.30% +1.46%
==========================================
Files 350 351 +1
Lines 60430 49281 -11149
==========================================
- Hits 36762 30703 -6059
+ Misses 20754 15653 -5101
- Partials 2914 2925 +11 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
3580699 to
9c1e965
Compare
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com> Provide use command as alias for switch Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
Related #19867