366 Commits

Author SHA1 Message Date
dependabot[bot]
d77ca3e95a Go: Bump github.com/devfile/alizer from 1.0.1 to 1.2.1 (#7126)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Armel Soro <asoro@redhat.com>
2023-10-23 18:09:52 +02:00
Philippe Martin
0f828ec99f Ignore devstate when existing process name is not odo + delete devstate files with odo delete component (#7090)
* 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
2023-09-20 14:20:53 +02:00
Philippe Martin
7c976f1bf1 Remove kubeconfig flag (#7017)
* 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
2023-08-04 11:52:19 +02:00
Philippe Martin
d41364e68e odo init filters devfile stacks by supported architectures (#7004)
* Add --architecture flag

* Ask architecture during interactive mode

* Display architectures of detected Devfile

* Fix integration tests

* Fix automated doc

* Fix e2e tests

* Ignore empty lines on doc automation tests

* Update pkg/odo/cli/registry/registry.go

Co-authored-by: Armel Soro <armel@rm3l.org>

* Fix Architectures field in API

* Change "select architectures" prompt

---------

Co-authored-by: Armel Soro <armel@rm3l.org>
2023-08-01 19:36:48 +02:00
Armel Soro
abdb1c568d Update go.mod with new location of the Alizer library (#6962)
* 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
2023-07-17 12:57:31 +02:00
Armel Soro
147542db69 Do not necessarily error out if odo dev is stopped via Ctrl+C (#6917)
* 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
2023-06-22 13:14:07 +02:00
Armel Soro
28ed064133 Do not return an error in odo analyze if current directory contains an invalid Devfile (#6905)
* 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
2023-06-22 10:06:18 +02:00
Philippe Martin
a29253521c Replace odo delete component integration with unit tests (#6904) 2023-06-21 17:43:03 +02:00
Philippe Martin
aabbded7e1 Unit tests/inject test clientset (#6874)
* Inject testClientset

* Test analyze CLI as unit test

* Replace odo analyze integration tests with unit tests
2023-06-13 13:16:31 -04:00
Philippe Martin
330b724753 Add an odo run command to manually execute command during odo dev (#6857)
* 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
2023-06-02 09:33:21 -04:00
Philippe Martin
bd5098eb53 Use devstats.PID.json as devstate (#6713)
* Use devstate.PID.json

* odo describe component gets forwarded ports from devstate.json

* Pass pid in context

* Add platform to state

* Overwrite devstate.json if PId not exists

* odo describe component displays forwarded ports from podman/cluster

* Start only one session on platform

* Fix integration test

* Review

* Fix

* Update pkg/state/errors.go

Co-authored-by: Armel Soro <armel@rm3l.org>

* Integration tests

* Fix integration test

---------

Co-authored-by: Armel Soro <armel@rm3l.org>
2023-04-19 04:16:08 -04:00
Philippe Martin
06b95fc0bd Change wording for dev/deploy (#6408)
* Change wording for dev/deploy

* Update doc

* Fix help tests

* Update deploy help message
2023-01-09 14:34:05 -05:00
Philippe Martin
1807939c7b Fix preference not taken into account for odo version (#6415)
* 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>
2022-12-15 09:40:08 -05:00
Philippe Martin
712254ae66 Centralize environment configuration (#6293)
* 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
2022-11-17 17:57:34 +00:00
Charlie Drage
149d16f2b7 Remove italic output throughout odo (#5612)
<!--
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>
2022-03-31 00:54:59 -04:00
Philippe Martin
24fd02673d Remove github.com/pkg/errors dependency (#5557)
* 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
2022-03-21 11:32:42 +01:00
Philippe Martin
e63773cc15 Separate layers : Preference (#5296)
* Refactor preference package

* Unit tests

* Apply suggestions from code review

Co-authored-by: Parthvi Vala <pvala@redhat.com>

* Review

* Review from Dharmit

* Replace panic with LogErrorAndExit

* Remove preference from kclient/oc_server

* Remove preference.New from devfile

* Remove preference.New from kclient/WaitAndGetPodWithEvents

* Get prefClient from CreateOptions

* Parthvi review

Co-authored-by: Parthvi Vala <pvala@redhat.com>
2022-01-10 16:00:53 +01:00
Tomas Kral
5f79c542a8 openshift/odo -> redhat-developer/odo (#5268)
* openshift/odo -> redhat-developer/odo

* update more links to redhat-developer
2021-12-01 16:38:34 +01:00
Parthvi Vala
322b6d2ec4 Collect Component type for usage data (#4662)
* 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
2021-05-20 01:31:57 -04:00
Parthvi Vala
c98445f8bb Enter Telemetry (#4482)
* 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>
2021-03-26 11:43:09 +00:00
John Collier
a3f0d4fcd7 Don't set a default value for -o flag and fix ODO_LOG_LEVEL check (#3121)
* Don't set a default value for -o flag

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Change how `output` flag is looked up

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Update comment

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Properly retrieve value of ODO_LOG_LEVEL

Signed-off-by: John Collier <John.J.Collier@ibm.com>
2020-05-12 16:02:30 -07:00
Tomas Kral
a82f3e0256 Update openshift to 4.4. and k8s to 1.17 (#3081)
* update openshift libs to 4.4

* update vendor
2020-05-06 18:53:51 +02:00
Tomas Kral
0408e03d3e use just odo insetad of odo (OpenShift Do) (#3030) 2020-04-29 07:45:57 +02:00
Mrinal Das
265c965cf7 Exports ODO_LOG_LEVEL env variable in integration tests (#2595)
* Exports ODO_LOG_LEVEL env variable in integration tests

* Turns off ODO_LOG_LEVEL if a valid json flag is passed
2020-02-19 03:20:49 +01:00
Yusuf Kanchwala
5eb0ff5e73 Add env variable "ODO_LOG_LEVEL" to control odo verbosity (#2351) (#2378)
* Add enviroment variable "ODO_LOG_LEVEL" to control odo verbosity. Command line flag "-v", if set, will take precedence over "ODO_LOG_LEVEL"
2019-11-12 11:50:34 +01:00
Daniel Helfand
493196b496 change Odo reference to odo for cli-docs (#2278) 2019-10-14 12:09:09 +02:00
Charlie Drage
73fecae98b Makes update information italic text (#2086)
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`
2019-09-10 11:11:35 +02:00
Charlie Drage
990928dee0 Update the CLI reference doc generation script (#1716)
* 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
2019-05-14 13:14:22 +02:00
Tomas Kral
6bd0d73dc6 redhat-developer/odo -> openshift/odo (#1505)
* redhat-developer/odo -> openshift/odo

* gofmt

* add CircleCI tests temporary back to TravisCI
2019-03-21 17:36:28 +01:00
girish ramnani
2a47599245 broke out the preferences and config (#1362)
* 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
2019-03-04 22:26:24 +05:30
girish ramnani
2bc274e3bc Support for global and local odo-config files (#1168)
* 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
2019-02-11 10:04:39 +01:00
glefloch
5cff1a1f63 Rename CheckError to LogErrorAndExit
Signed-off-by: glefloch <glfloch@gmail.com>
2019-01-04 14:20:26 +00:00
Chris Laprun
1045bdbab6 Fix #1086: exit with 0 code on help (#1093)
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).
2018-12-07 11:00:30 -05:00
Chris Laprun
730fd5bbab Restore completion access and fix help display. 2018-11-29 15:45:28 +01:00
Chris Laprun
6afbf7099d Don't ignore error. 2018-11-29 14:04:30 +01:00
Chris Laprun
e8fe98d936 Fix help display with -h. 2018-11-29 14:04:30 +01:00
Chris Laprun
5042cd1d80 Remove useless comparison to true. 2018-11-29 13:58:31 +01:00
Chris Laprun
73c74946eb Replace RootCmd() by NewCmdOdo function and use it. 2018-11-29 13:58:30 +01:00
Girish Ramnani
4ab05f69c4 resolved golint errors for variable names and comments incorrectly written 2018-11-28 18:03:15 +05:30
Georgios Andrianakis
2d9ab2825a Fix panic when no args supplied to cli-doc (#1048)
Fixes: #1047
2018-11-27 15:23:56 +05:30
Chris Laprun
6d05c4ba9d Move commands to where they should be (#1002)
* 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.
2018-11-22 13:22:03 +05:30
Suraj Narwade
83cebd1a01 Added command auto completion for odo storage (#986)
Fixes #941
2018-11-21 19:58:48 +05:30
Mrinal Das
3d2076cfbd Added file completion support for update command (#1013) 2018-11-21 14:13:30 +05:30
Charlie Drage
82968cb05b 0.0.16 Release (#1018) 2018-11-20 15:28:01 -05:00
Syam.G.Krishnan
9bef06e0d2 fix #995 : change component selection logic in update cmd (#999)
change the component selection part to use context.Component()
2018-11-20 19:05:46 +05:30
girish ramnani
e364c3598c resolved bug in the way componentCmd was added FlagSet (#1000) 2018-11-16 12:39:47 -05:00
Georgios Andrianakis
87d30e7416 Add go completion for odo url delete (#980)
Fixes: #938
2018-11-16 11:56:08 +02:00
Chris Laprun
5e144c448a Fix broken tests. 2018-11-15 11:24:17 +01:00
Mrinal Das
80e299f8ea Added the project auto completion code (#959)
* Added the project auto completion code

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Added getUserTypedCommands function fro getting user typed entitites

Signed-off-by: mik-dass <mrinald7@gmail.com>
2018-11-15 10:34:16 +01:00
Charlie Drage
2f7ed49711 Release 0.0.15 (#972) 2018-11-13 12:55:09 -05:00