-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Support prompt for certain argocd cmd commands #19528
Labels
component:cli
Affects the Argo CD CLI
component:core
Syncing, diffing, cluster state cache
enhancement
New feature or request
type:enhancement
Comments
alexmt
added
component:cli
Affects the Argo CD CLI
component:core
Syncing, diffing, cluster state cache
type:enhancement
labels
Aug 14, 2024
14 tasks
pasha-codefresh
pushed a commit
that referenced
this issue
Oct 25, 2024
…19528) (#19637) * Add `Prompt`, with `prompts.enabled` setting in `argocd-cm` Signed-off-by: David Wu <[email protected]> * Make `SettingsOpts`, `SettingsOpts.ArgocdCMPath`, `SettingsOpts.CreateSettingsManager()` and `commandContext.CreateSettingsManager()` exportable Signed-off-by: David Wu <[email protected]> * Add `prompt_test.go` Signed-off-by: David Wu <[email protected]> * Refactor `NewPrompt()` and move into new package `utils` Signed-off-by: David Wu <[email protected]> * Update `NewPrompt()` to use local config Signed-off-by: David Wu <[email protected]> * Add `NewConfigurationCommand()` Signed-off-by: David Wu <[email protected]> * Move `prompt_test.go` Signed-off-by: David Wu <[email protected]> * Remove `prompt_test.go` for now Signed-off-by: David Wu <[email protected]> * Add back and update `prompt_test.go` Signed-off-by: David Wu <[email protected]> * Add `configuration_test.go` Signed-off-by: David Wu <[email protected]> * Fix linting issues Signed-off-by: David Wu <[email protected]> * Fix linting issues Signed-off-by: David Wu <[email protected]> * Reverse early-termination logic in `Confirm()` Signed-off-by: David Wu <[email protected]> * Rename `ArgocdCMPath` to `argocdCMPath` Signed-off-by: David Wu <[email protected]> * Rename `SettingsOpts` to `settingsOpts` Signed-off-by: David Wu <[email protected]> * Rename `CreateSettingsManager()` to `createSettingsManager()` Signed-off-by: David Wu <[email protected]> * Rename `configuration` to `configure` Signed-off-by: David Wu <[email protected]> * Further rename `configuration` to `configure` Signed-off-by: David Wu <[email protected]> * Remove redundant Argo CD ConfigMap logic Signed-off-by: David Wu <[email protected]> * Fix terminal output spacing Signed-off-by: David Wu <[email protected]> * Make `argocd configure` use local config value as the default value for `--prompts-enabled` Signed-off-by: David Wu <[email protected]> * Add global CLI flag `--force-prompts-enabled` Signed-off-by: David Wu <[email protected]> * Update existing `prompt_test.go` test cases Signed-off-by: David Wu <[email protected]> * Add test case for `(p *Prompt).Confirm()` Signed-off-by: David Wu <[email protected]> * Add test cases for `GetBoolFlagWithFallback()` to `env_test.go` Signed-off-by: David Wu <[email protected]> * Format imports Signed-off-by: David Wu <[email protected]> * Further format imports and remove unused variable Signed-off-by: David Wu <[email protected]> * Again format imports Signed-off-by: David Wu <[email protected]> * Add fallback to `GetPromptsEnabled()` Signed-off-by: David Wu <[email protected]> * Fix bug in `GetPromptsEnabled()` Signed-off-by: David Wu <[email protected]> * Fix missing import Signed-off-by: David Wu <[email protected]> * Add auto-generated docs for `argocd configure` Signed-off-by: David Wu <[email protected]> * Add auto-generated docs for new global CLI flag `--force-prompts-enabled` Signed-off-by: David Wu <[email protected]> * Update `NewPrompt()` to receive a `bool` rather than `*apiclient.ClientOptions` arg Signed-off-by: David Wu <[email protected]> * Remove arg `fallback` from `GetPromptsEnabled()` Signed-off-by: David Wu <[email protected]> * Add arg `useCLIOpts bool` to `GetPromptsEnabled()` Signed-off-by: David Wu <[email protected]> * Make `config.LoadFlags()` exportable Signed-off-by: David Wu <[email protected]> * Add tests for `GetPromptsEnabled()` Signed-off-by: David Wu <[email protected]> * Fix linting errors in tests Signed-off-by: David Wu <[email protected]> * Run `make codegen-local` Signed-off-by: David Wu <[email protected]> --------- Signed-off-by: David Wu <[email protected]>
This was referenced Oct 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component:cli
Affects the Argo CD CLI
component:core
Syncing, diffing, cluster state cache
enhancement
New feature or request
type:enhancement
Summary
It would be beneficial for some admin commands to display an "Are you sure" prompt before proceeding, with some extra info about the expected result of the command.
Motivation
Example use cases:
"argocd admin export" only exports ArgoCD apps from the same namespace as where ArgoCD is deployed #14596
feat: add prompting to confirm remove of repository credentials #11040
feat: add prompting to confirm deletion of gpg public key #10415
Proposal
Enabling the prompt by default is a breaking change for CI pipelines/other automations running argocd cmd.
As a gradual non-breaking solution, a feature flag
enable-argocd-cmd-prompt: false
can be introduced, along with the supporting core functionality, and docs stating that enabling this feature would require a change in the CI/automation that runs the argocd cmd.An additional "--auto-approve-prompt" flag should be also be introduced for usage in the CI/automation after enabling the feature flag.
In the future, if it would be desired for the default behavior to be with the prompt,
enable-argocd-cmd-prompt: true
can be introduced as the default, for v3, along with detailed docs.The text was updated successfully, but these errors were encountered: