* Ignore devstate when existing process name is not odo
* Delete orphan devstate files with odo delete component
* Update unit tests
* Create fake system
* Add unit tests for odo delete component
* Integration tests for odo dev
* Troubleshooting
* First process on Windows is 4
* Use go-ps lib for pidExists
* Remove kubeconfig flag
* Do not check file exists from KUBECONFIG, as KUBECONFIG can be a list of files and this is done by clientcmd library
* Fix odo --help
* Add integration test to check flag is not supported
* Update 'go.mod' with new location of the Alizer library
* Downgrade and pin conflicting versions of 'github.com/docker/{cli,distributions}'
Pinning it to the version we had before.
Otherwise, there were issues when running 'go mod tidy':
```
$ go mod tidy
go: downloading github.com/operator-framework/api v0.17.6
go: finding module for package github.com/docker/docker/pkg/term
github.com/redhat-developer/odo/pkg/auth imports
github.com/openshift/oc/pkg/cli/login imports
github.com/openshift/oc/pkg/helpers/term imports
github.com/docker/docker/pkg/term: module
github.com/docker/docker@latest found
(v24.0.4+incompatible), but does not contain
package github.com/docker/docker/pkg/term
```
* Fix expected output in quickstart guides doc automation tests
* Add test highlighting the expectations
* Propagate errors and call os.Exit only in 'main' functions
See ExitInMain[1] and ExitInMain_ExitOnce[2] coding convention guidelines.
[1] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-in-main
[2] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-once
* Handle errors returned by Cleanuper#Cleanup
This makes sure the exit code of the command
is mapped onto any error returned by Cleanup
* Do not return an error when the watch loop in 'odo dev' is interrupted
* Test that the exit code of 'odo dev' matches the error returned by the cleanup logic
* Add unit test highliging the issue
* Fix 'delete' unit tests
* Pass the filesystem object where it is relevant
* Add a way for CLI commands to indicate whether of not they require a valid Devfile
For the 'analyze' command, this is not required,
so Devfile parsing will be ignored completely.
* Make the fake filesystem return an absolute current dir
Otherwise, some code will assume it is relative,
and try to prepend the current physical directory
* Add a run command
* Check command name passed as arg
* Check platform is available
* Add a Run method to the DevClient
* Run command on cluster
* Add test with run command on cluster
* Implement and test run on podman
* Enhance test to check that command has been executed in container
* Fix `odo help` test
* Refactor common code for podman/cluster
* Test Apply commands on Kubernetes/Images
* Test a msg is displayed when executing odo run without odo dev
* Review
* makes GetRunningPodFromSelector return only Running pods on Podman
* Quick fix
* Test grouping of comands in odo help
* Create a CommandGroup abstraction
* Expect a non-nil Preference Client
Co-authored-by: Armel Soro <armel@rm3l.org>
Co-authored-by: Armel Soro <armel@rm3l.org>
* Define central config
* Use envConfig in GenericRun for segment parameters
* Pass the env config into the context passed to CLI methods
* Use PodmanCmd and DockerCmd from context
* Remove tests now that ODO_DISABLE_TELEMETRY is checked for a bool value
* deploy.Deploy: Use values from ctx instead of parameters + use FS from DI
* dev.Start: Use values from ctx instead of parameters
* image.Build*: Use values from ctx instead of parameters
* Use telemetry file from context
* Pass ctx to segment.getTelemetryForDevfileRegistry
* Use ctx in getTelemetryForDevfileRegistry
* Call IsTelemetryEnabled once and use scontext.GetTelemetryStatus after
* Fix unit tests
* Use envConfig in segment.IsTelemetryEnabled
* Define TelemetryCaller constant in test helper
* IsTrackingConsentEnabled: get value from envconfig instead of env
* Use ctx instead of GLOBALODOCONFIG
* Place ODO_EXPERIMENTAL_MODE in configuration
* Use maintained envconfig package
* Define default values when exist
* Document accepted boolean values
<!--
Thank you for opening a PR! Here are some things you need to know before submitting:
1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines
2. Label this PR accordingly with the '/kind' line
3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests
4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline
Documentation:
If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing
-->
**What type of PR is this:**
<!--
Add one of the following kinds:
/kind bug
/kind feature
/kind cleanup
/kind tests
/kind documentation
Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well.
-->
/kind cleanup
**What does this PR do / why we need it:**
Remove all italic output throughout odo with the exception of building
images / pushing images.
Makes all output consistent with `odo dev` and `odo deploy`
**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->
N/A
**PR acceptance criteria:**
- [X] Unit test
- [X] Integration test
- [X] Documentation
**How to test changes / Special notes to the reviewer:**
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
* Change errors.Wrapf
* Replace errors.Wrap
* Dont use pkg/errors (except error.Cause)
* Fix errors on Windows (do not test system underlying message)
* Replace errors.Cause
* Review
* Add support for componentType to telemetry and replace Execute with ExecuteContext to support context
* Make o.Run() compatible with ExecuteContext
* Add unit tests for upload with context
* Fix ci unit test failure
* Move context code to a separate package within the segment package
* separate private and public methods, reorganize
* fix import
* Send telemetry to segment
* Add tests and other properties
* Add comments
* Fix fmt
* Add telemetry dev key
* Add non-test related changes requested to the PR and add consenttelemetry prompt
* Handle prompt while running tests
* First attempt at fixing unit job failure
* Modify tests as requested
* Stop prompting when preference is called
* Fix comments
* Add more unit tests and integration test(WIP)
* Fix failing tests
* Stop prompting when help is called
* Make tests more verbose
* Add Usage data doc
* Add segment key
* Add a better usage doc
* Add comments, move tests and other requested changes
* Fix comments and remove focus
* Add set ConsentTelemetry unit tests
* Change want from string to bool
* Fix failing integration test
* Fix failing operator hub test
* Fix failing devfile integration test
* Fix tests failing due to cmdwrapper WithEnv
Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
Changes the update information to display at italic in order to not get
mixed in with the other output.
Also remove the quotes for `odo preference set UpdateNotification false`
so it's easier to copy-and-paste from the terminal.
To test:
1. Modify pkg/odo/cli/version/version.go VERSION var to "v1.0.0-beta4"
or any version previous
2. Compile
3. Run a standard create command `odo create nodejs`
* Update the CLI reference doc generation script
This updates the CLI reference doc generation script as well as the
current documentation within the help menu (odo not using correct
capitalization).
* Modify description
* Update cli reference again
* broke out the preferences and config
* resolved UTs
* resolved golangCI comments
* resolved some e2e tests
* resolved error message in tests
* Resolved codeclimate issue
* resolved the e2e_test failure
* resolved some comments on the PR
* renamed GlobalConfig to Preference
* made the logic of unset simpler
* reverted the test changed
* use log instead of fmt for output
* resolved e2e test
* use log.Info instead of log.Println
* renamed the config file
* broke the config into global and local config structs
* lookup added
* use the global config everywhere
* resolved tests
* resolved logs and application_test
* added support for global flag in utils config cli
* resolved failed tests
* resolved code climate issues
* updated help and added e2e test
* updated the cli reference
* added configuration check, common config and success message
* added check for user confirmation
* Resolved the failing config test
* add force flag
* not show default values when doing config view
* resolved failing tests
* created proxy New method and refactored to CVR pattern for global stuff
* resolved tests
* used the check in set local config
* local odo config created only when we set config
* added delete command and tests
* removed focus
* resolved code climate error
* resolved go ci issue
* resolved config tests
* CamelCased the config and regen the cli ref
* removed allNil check and added delete invalid error message
* renamed delete to unset and updated tests
* removed fit
* resolved local build issue
Make CommandLine not exit on error and intercept flag.ErrHelp to return
0 instead of default behavior of flag.Parse which is to exit with code 2
on error (flag.ErrHelp is raised when help is asked).
* Move main to cmd/odo.
* Refactor doc generation into one single command.
* Rename for consistency.
* Move commands to pkg/odo/cli.
* Export Add*Flag functions to prepare for move.
* Move validateName to pkg/odo/cli/util/validation.go.
* Move functions used by only one command to the command file.
* Renamed to storage_test since tests are storage-related.
* Move usage template to cmdutils.
* Use RootCmd() instead of var access.
* Move printComponentInfo back to cmdutils and expose.
* Move application to application package.
* Move component to component package. Move componentShortFlag also.
Not sure why it was on delete and not on component.
* Move commands to appropriate packages.
* Rename root to cli.
* Rename main to odo.
* Fix wrong reference to main file.
* Fix(?) generate-coverage.sh.
* Move root command name to cli.go.
* Move Add*Flag functions to genericclioptions/context_flags.
Move adding completion handler to package-specific functions
(duplication >_<)
* Move CmdUsageTemplate and PrintComponentInfo to odo/util package.
* Move VERSION and getLatestReleaseInfo to cli/version package.
Remove now empty cmdutils.
* Start using NewCmd* instead of init. Break import cycle. :)
* Rename client to cmdutils.
* Move to use NewCmd* pattern for all commands.
* Fix cross-compilation target.