* Add `Prompt`, with `prompts.enabled` setting in `argocd-cm`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Make `SettingsOpts`, `SettingsOpts.ArgocdCMPath`, `SettingsOpts.CreateSettingsManager()` and `commandContext.CreateSettingsManager()` exportable
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add `prompt_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Refactor `NewPrompt()` and move into new package `utils`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Update `NewPrompt()` to use local config
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add `NewConfigurationCommand()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Move `prompt_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Remove `prompt_test.go` for now
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add back and update `prompt_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add `configuration_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix linting issues
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix linting issues
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Reverse early-termination logic in `Confirm()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `ArgocdCMPath` to `argocdCMPath`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `SettingsOpts` to `settingsOpts`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `CreateSettingsManager()` to `createSettingsManager()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Rename `configuration` to `configure`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Further rename `configuration` to `configure`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Remove redundant Argo CD ConfigMap logic
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix terminal output spacing
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Make `argocd configure` use local config value as the default value for `--prompts-enabled`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add global CLI flag `--force-prompts-enabled`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Update existing `prompt_test.go` test cases
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add test case for `(p *Prompt).Confirm()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add test cases for `GetBoolFlagWithFallback()` to `env_test.go`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Format imports
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Further format imports and remove unused variable
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Again format imports
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add fallback to `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix bug in `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix missing import
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add auto-generated docs for `argocd configure`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add auto-generated docs for new global CLI flag `--force-prompts-enabled`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Update `NewPrompt()` to receive a `bool` rather than `*apiclient.ClientOptions` arg
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Remove arg `fallback` from `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add arg `useCLIOpts bool` to `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Make `config.LoadFlags()` exportable
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Add tests for `GetPromptsEnabled()`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Fix linting errors in tests
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
* Run `make codegen-local`
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
---------
Signed-off-by: David Wu <155603967+david-wu-octopus@users.noreply.github.com>
The argocd app diff command returns 1 if a difference is found. In related issues,
they want to return an error code that is distinguishable from common errors.
However, changing the existing behavior is likely to break user's automation code.
So we want to provide an explicit option(--diff-exit-code) to specify an error code.
Related: #3588
Signed-off-by: Eugene Kim <eugene70kim@gmail.com>
* fixed doc comments and added unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Added comments for the newly added unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Refactored method name to deriveServiceAccountToImpersonate
Signed-off-by: anandf <anjoseph@redhat.com>
* Using const name in return value
Signed-off-by: anandf <anjoseph@redhat.com>
* Added unit tests for argocd proj add-destination-service-accounts
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed failing e2e tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Fix linting errors
Signed-off-by: anandf <anjoseph@redhat.com>
* Using require package instead of assert and fixed code generation
Signed-off-by: anandf <anjoseph@redhat.com>
* Removed parallel execution of tests for sync with impersonate
Signed-off-by: anandf <anjoseph@redhat.com>
* Added err checks for glob validations
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed e2e tests for sync impersonation
Signed-off-by: anandf <anjoseph@redhat.com>
* Using consistently based expects in E2E tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Added more unit tests and fixed go generate
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed failed lint errors, unit and e2e test failures
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed goimports linter issue
Signed-off-by: anandf <anjoseph@redhat.com>
* Added code comments and added few missing unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
* Added missing unit test for GetDestinationServiceAccounts method
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed goimports formatting with local for project_test.go
Signed-off-by: anandf <anjoseph@redhat.com>
* Corrected typo in a field name additionalObjs
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed failing unit tests
Signed-off-by: anandf <anjoseph@redhat.com>
---------
Signed-off-by: anandf <anjoseph@redhat.com>
* feat(appset): Add a cache layer for Argo Projects to speed-up application validation
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* Use local client rather than custom cache
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* Clean go.mod
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* Merge master
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* Fix after merging master
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* Initialize appProject variable inside loop
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* Remove unused ArgoAppClientset field
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* Fix linter issue
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
---------
Signed-off-by: Philippe Da Costa <pdacosta@gmail.com>
* chore: transmit manifest-generate-path resources to the cmp-server for plugin-based applications
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* use SecureJoin
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* make cmp manifests generation using manifest generate path annotation configurable by environment variable
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* fix missing doc running codegen-local
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* set reposerver.plugin.enable.manifests.generation.using.annotations false by default
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* Fix conflict
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* autogenerate install manifests
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* add note about common root path calculation for manifest paths annotation
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* log common root path calculated
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* app path must be the lower common path
Signed-off-by: Javier Solana <javier.solana@cabify.com>
* tweaks
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
---------
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Javier Solana <javier.solana@cabify.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* feat: option to disable writing k8s events
optioned to write logs for k8s events.
Each is passed as an environment variable and defaults to true,
disabling it requires explicitly setting the option to false.
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
* feat: option to disable writing k8s events
fix unit test
- application_test
- applicationset_test
- project_test
- appcontroller_tes
- audit_logger_test
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
* rebase
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
---------
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
* feat: allow auth token to be passed in via env
Allows the authentication token to come from environment if it's not found in cli args.
Signed-off-by: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com>
* chore: generate cli docs
Signed-off-by: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com>
---------
Signed-off-by: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com>
Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
* Add proxy url arg for repocreds command.
Co-authored-by: Li Wang <li.wang3@fmr.com>
Signed-off-by: Miao Haoda <Haoda.Miao@fmr.com>
* commit the results of clidocsgen
Signed-off-by: Miao Haoda <Haoda.Miao@fmr.com>
---------
Signed-off-by: Miao Haoda <Haoda.Miao@fmr.com>
Co-authored-by: Li Wang <li.wang3@fmr.com>
Closes#13096
Implement a new metric exposing Applications conditions.
This is particularly useful for SRE teams to be able
to setup alerts on issues that aren't displayed via
"health_status" and "sync_status" in the metric "argocd_app_info".
Signed-off-by: Foyer Unix <foyerunix@foyer.lu>
Co-authored-by: Foyer Unix <foyerunix@foyer.lu>
* Implementation of app sync with impersonation support
Signed-off-by: anandf <anjoseph@redhat.com>
* negation test
Signed-off-by: Mangaal <angommeeteimangaal@gmail.com>
* Update doc comments to remove server name as its not supported.
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com>
* Update glob pattern check for matching destinations.
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com>
* Corrected the code comments for namespace field and destination matching logic
Signed-off-by: anandf <anjoseph@redhat.com>
* Added missing generated files
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed golint errors caused due to to gofumpt validations
Signed-off-by: anandf <anjoseph@redhat.com>
* Fix golint errors with unit test code
Signed-off-by: anandf <anjoseph@redhat.com>
* Updated the go import ordering with local packages at the end
Signed-off-by: anandf <anjoseph@redhat.com>
* Addressed review comments
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed ES lint error caused due to missing class
Signed-off-by: anandf <anjoseph@redhat.com>
* Updated the documentation to address the review comments
Signed-off-by: anandf <anjoseph@redhat.com>
* Simplified the sync code and improved logs and error handling
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed E2E tests to fail when no sa is configured
Signed-off-by: anandf <anjoseph@redhat.com>
* Updated help message generated for CLI commands
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed failing tests due to default service account not used for sync operation
Signed-off-by: anandf <anjoseph@redhat.com>
* Fixed the error message when sync fails due to no matching sa
Signed-off-by: anandf <anjoseph@redhat.com>
* Removed repeating logs and added impersonation fields to logger
Signed-off-by: anandf <anjoseph@redhat.com>
* Made changes in the proposal to match the behaviour when no matching sa is found
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
---------
Signed-off-by: anandf <anjoseph@redhat.com>
Signed-off-by: Mangaal <angommeeteimangaal@gmail.com>
Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Co-authored-by: Mangaal <angommeeteimangaal@gmail.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
This update refactors the `IncludeResource` logic to improve accuracy in resource filtering.
Also, it includes new test cases to ensure the correctness of the changes.
Fixes: #17397
Changes:
- Rewritten `IncludeResource` function for better logic flow.
- Added unit tests to validate the new behavior.
- Found that two existing test cases were incorrect and fixed them. A closer review of this part is needed.
Signed-off-by: Eugene Kim <eugene70kim@gmail.com>
* chore: remove unused params
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* more
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
---------
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* add support for all namespaces for apps and appsets in export and import
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
* cleanup accidental merge issue
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
* address comments and run lint
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
* small fix
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
* switch to make for slice
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
* remove new line in command flags
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
---------
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>