Commit Graph

49 Commits

Author SHA1 Message Date
Armel Soro
d34fbaed1a Make warning messages more visible (#7097)
* Wrap warning messages to make them more visible

For example, instead of displaying:
```
⚠  You are using "default" project, odo may not work as expected in the default project.
```

We are now displaying:
```
========================================================================================
⚠  You are using "default" project, odo may not work as expected in the default project.
========================================================================================
```

* Display warning message about default project/namespace in a single block

* Add unit test

* Fix sample outputs for doc automation tests

* Revert "Fix sample outputs for doc automation tests"

This reverts commit 98a6554c34.

* Ignore '===' warning header and footer for doc automation tests
2023-09-26 02:53:45 -04:00
Armel Soro
725a64014a Display Git commit ID in output of odo commands where the version is shown (#7074)
* Display Git commit ID in output of odo commands where the version is displayed

This covers:
- odo init
- odo dev
- odo deploy

Displaying the commit ID (same as in `odo version`) will help quickly pinpoint the exact commit without having to run `odo version`.

See #6131 for more context

* Append the state of the working tree next to the Git commit ID

`git describe` is much more helpful to quickly understand the state of the working tree.

For backward compatibility, we are defaulting to `git rev-parse`,
just in case `git describe` does not work correctly.

* Fix integration tests

* Fix doc automation tests

Strip the Git commit ID from the full odo version string
prior to comparing the outputs.
We still want to compare the tag displayed.
2023-09-06 20:36:13 +02:00
Philippe Martin
a29253521c Replace odo delete component integration with unit tests (#6904) 2023-06-21 17:43:03 +02:00
Armel Soro
46abd92226 Display a generic Experimental mode warning message when this mode is enabled (#6426)
* Display a generic Experimental mode warning message when this mode is enabled

This fixes the issue of having this warning displayed for a specific feature
that might not be used by the user.
Instead, we are now displaying a more generic and feature-agnostic warning
message once.

* Drop useless 'id' field in OdoFeature struct
2022-12-20 07:37:13 -05:00
Armel Soro
a811cc1bd0 Add support for an experimental mode (#6300)
* Add support for an experimental mode at the CLI level

This is backed by an "ODO_EXPERIMENTAL_MODE" environment variable.

* Mark the generic '--run-on' flag as experimental

Besides being hidden, it will error out as invalid flag
if the ODO_EXPERIMENTAL_MODE env var is not set to 'true'.

* Add integration test cases

* Document the experimental mode.

* fixup! Add support for an experimental mode at the CLI level

* fixup! Mark the generic '--run-on' flag as experimental
2022-11-14 12:11:50 +00:00
Dharmit Shah
f062c11a11 Update odo to use go 1.18 (#6166)
* Update odo to use go 1.18

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Update golangci-lint version in Makefile

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Use go 1.18, not go 1.19

Erroneously I had used go 1.19 at various places.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Rearrange imports; fix golangci-lint errors

Fixed a bunch of golangci-lint errors like below:

`File is not `gofmt`-ed with `-s``

using the command: `golangci-lint run --fix`

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Use go install instead of go get

This is because with go 1.18, `go get` behaves as `go get -d` by
default. Which means that it will only download, but not install.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
2022-11-09 05:31:38 -05:00
Armel Soro
1d719f010c Display "Interactive mode enabled" only when running odo init interactively (#6100)
* Display "Interactive mode enabled" only when running `odo init` interactively

* fixup! Display "Interactive mode enabled" only when running `odo init` interactively
2022-09-07 15:48:55 +02:00
Dharmit Shah
72d632bbed Allow specifying message to end the spinner with (#5972)
* Allow specifying message to end the spinner with

For certain long running tasks, we need to specify a message that
doesn't confuse the user when the spinnner ends. This commit adds
`EndWithStatus` which is a wrapper on top of `End` and lets the
developer specify a custom message to end the spinner with.

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>

* Update pkg/devfile/adapters/kubernetes/component/commandhandler.go

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

Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
2022-08-16 12:35:49 +00:00
Philippe Martin
f22c3f854d odo dev: react to changes as soon as possible (#5933)
* Create auxialiary functions to find current deployment and pod name

* Create auxialiary function for pushing Kubernetes components to cluster

* Auxiliary function getPushDevfileCommands and remocve RunModeChanged flag as it is not possible anymore with long running dev command
+ move prelimiray tests at the beginning

* Create auxiliary function updatePVCsOwnerReferences + move isMainStorageEphemeral inside aux. function

* Watch for deployments in addition to watching for files during odo dev

* - Check the Deployment Generation to return earlier when generation changed
- Return earlier when pod is not ready

* Push receives a Status that it can update, to indicate the status of the component when the function returns. This status is passed from Start to Watch

* Use status to decide to sync files

* Simplify getting pod

* Status for PostStartEvents

* - Touch .gitignore earlier so it is not synced
- Add devstate.jso file to .gitignore

* Fix the integration tests.

* Make --no-watch work again

* Get smaller volumes for tests

* Quit when fail to exec port forwarding

* Exponential delay after an error

* Fix: get running pod

* Remove testing odo dev stops when the build command fails. odo dev now gives a change to the user to fix the problem

* Fix order or volumes and volume mounts in pod spec

* Use server side apply for updating PVC when supported

* Watch Devfile separately

* Adapt tests for devfile handled separately

* Update forwarded ports when necessary

* Display kubernetes resources created only when created/updated

* Do not set ResourceVersion when patching

* TEMP: Add more logs on failing integrattests

* Tests: select the *running* pod

* Use forward slashes for .gitignore content, even on Windows

* Rename GetOnePodFromSelector to GetRunningPodFromSelector

* Cleanup logs

* Fix 'odo log' integration test

* Add log "Waiting for Kubernetes resources"

* Fail if service bindings are not injected

* Rename sources related watcher, timer

* Fix delay after error

* Display info about Pod

* Disambiguate error messages

* Display events related to components pod

* Remove now unused functions used to wait for Deployment / Pod

* Typos + function renaming

* Do not watch devfile with --no-watch

* Use type switch for Kubernertes watch event

* Do not fail when watching Events is Forbidden

* Do not fail when servicebinding resources are forbidden

* Exit when build command fails on no-watch mode

* Sync devfile.yaml by default, workaround when commands change on devfile

* Rename to warningsWatcher

* Fix comment
2022-08-08 10:20:55 +00:00
Charlie Drage
02bd7b8d01 Refactor color througout interactive mode and dev (#5963)
* Refactor color througout interactive mode and dev

<!--
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 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:**

This PR fixes the following:
- Updates the interactive mode so it's better looking when outputting
  configuration so it's similar to the rest of the output:

```sh
? Is this correct? Yes
 ✓  Downloading devfile "nodejs" from registry "DefaultDevfileRegistry" [1s]

↪ Container Configuration "runtime":
  OPEN PORTS:
    - 3000
  ENVIRONMENT VARIABLES:

? Select container for which you want to change configuration? runtime
? What configuration do you want change? Delete port "3000"
? What configuration do you want change? NOTHING - configuration is correct

↪ Container Configuration "runtime":
  OPEN PORTS:
  ENVIRONMENT VARIABLES:

? Select container for which you want to change configuration?  [Use arrows to move, type to filter]
  runtime
> NONE - configuration is correct
```

- Removes issue of fgGreen not appearing correctly because of direct use
  of `color` instead of log/status.go. This is due to color not
  detecting if the terminal supports the color, which is done in
  `log/status.go` instead.

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

Fixes https://github.com/redhat-developer/odo/issues/5843

**How to test changes / Special notes to the reviewer:**

Signed-off-by: Charlie Drage <charlie@charliedrage.com>

* Update to not use println in business layer

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2022-07-26 18:12:33 +02:00
Dharmit Shah
e3b3b8eb53 Add odo logs (#5760)
* Add odo logs

* Nolint for random number generation

* Changes based on Philippe's PR review

* Add logs for `odo logs`

* Add nolint at the right place to fix unit tests

* Changes based on PR feedback

* Name the key in unstructured.Unstructured

* Name containers with same names as c, c1, c2

* Remove unused struct field

* Modify documentation to follow general pattern

* Undo the changes done in earlier commits

* odo logs help message is accurate

* Update docs/website/versioned_docs/version-3.0.0/command-reference/logs.md

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

* Fixes broken link rendering

* Correct the example used in odo logs doc

* Make container name clearer in odo logs output

* Wrap at 120 chars, not 80

* Fixes to the document after rebase mistake

Co-authored-by: Parthvi Vala <pvala@redhat.com>
2022-06-13 00:57:30 -04:00
Philippe Martin
cb1546a67e odo describe component (#5725)
* odo describe component

* More fields on named describe

* Doc

* Update pkg/odo/cli/describe/component.go

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

* Update pkg/odo/cli/describe/component.go

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

* Update pkg/odo/cli/describe/component.go

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

* Add Describef

* Parthvi review

* Fix rebase

Co-authored-by: Parthvi Vala <pvala@redhat.com>
2022-05-12 06:30:47 -04:00
Charlie Drage
240890d64c Adds odo registry command (#5667)
* Adds odo registry command

<!--
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 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 feature

**What does this PR do / why we need it:**

This adds the `odo registry` command, to output the details of what's
in the registry.

It also implements the flags:
- `--filter`
- `--devfile`
- `--details`

This can be tested by typing in the `odo registry` command after adding
a registry (you should already have one by default)

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

Fixes https://github.com/redhat-developer/odo/issues/5524

**PR acceptance criteria:**

- [X] Unit test

- [X] Integration test

- [X] Documentation

**How to test changes / Special notes to the reviewer:**

`odo registry`

* Update based on review

Signed-off-by: Charlie Drage <charlie@charliedrage.com>

* List based on registry

Signed-off-by: Charlie Drage <charlie@charliedrage.com>

* Update tests + improve based on comments

* Move function down to business layer, fix tests

* Add business layer logic for sorting
2022-05-11 15:05:38 -04:00
Parthvi Vala
abc4b59369 Remove references to v2 commands, remove unused functions, and constants (#5638)
* Remove references to v2 commands, remove unused functions, and constants

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Dharmit's review

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-04-20 00:54:15 -04:00
Philippe Martin
4527363f47 odo init json output (#5658)
* odo init -o json

* docs

* fix header and json

* Make DevfileLocation part of api package

* Add Component api kind

* odo init -o json return value

* Document api package

* Update tests

* review

* Error when json output and no flags

* Update doc

* review
2022-04-19 07:40:35 -04:00
Charlie Drage
9c491b16fe Updates odo init output, fixes colorized output for tests. (#5613)
* Update vendoring for coloring to add NO_COLOR

* Updates odo init output / adds logo

<!--
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 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 feature

**What does this PR do / why we need it:**

We have the logo appearing in `odo dev` and `odo deploy`

Those 3 commands are the most used with `odo`, and the ones that are
most used. All three should have similar and consistent output that
contains:
  * What the component is doing (first line)
  * What's detected (in odo init, it's the files, in odo deploy and dev
    it's the component name)
  * odo version that is being used / outputted.

```sh
$ odo init
  __
 /  \__     Initializing a new component
 \__/  \    Files: No source code detected, a starter project will be created in the current directory
 /  \__/    odo version: v2.5.0
 \__/

Interactive mode enabled, please answer the following questions:
? Select language: javascript
? Select project type: Next.js
 ✓  Downloading devfile "nodejs-nextjs" from registry "DefaultDevfileRegistry" [450ms]
? Which starter project do you want to use? nodejs-nextjs-starter
? Enter component name: my-nodejs-nextjs-app
 ✓  Downloading starter project "nodejs-nextjs-starter" [516ms]

Your new component 'my-nodejs-nextjs-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
```

**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:**

N/A

Signed-off-by: Charlie Drage <charlie@charliedrage.com>

* Update based on reviews

Signed-off-by: Charlie Drage <charlie@charliedrage.com>

* Update based on review

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2022-04-12 09:41:45 -04:00
Charlie Drage
40f55ebdd3 Adds warning for running podman on Apple Silicon (#5629)
<!--
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 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 feature

**What does this PR do / why we need it:**

Warns the user if we are trying to run Podman on Mac M1. As we are
unable to build x86 images natively unless using the workaround.

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

Fixes https://github.com/redhat-developer/odo/issues/5597

**PR acceptance criteria:**

- [X] Unit test

- [X] Integration test

- [X] Documentation

**How to test changes / Special notes to the reviewer:**

Run it on a M1 mac :)

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2022-04-08 16:01:15 -04:00
Charlie Drage
7618e8f3e4 Improve UX/UI of odo deploy and dev (#5539) 2022-03-22 19:58:38 +01:00
Charlie Drage
23aad19ec9 Remove nanoseconds from spinner (#5558)
<!--
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 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 feature

**What does this PR do / why we need it:**

When using the spinner, we shouldn't output the spinner if it is less
than 1ms (nanoseconds).

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

Fixes https://github.com/redhat-developer/odo/issues/5380

**PR acceptance criteria:**

- [X] Unit test

N/A, unable to write (function could possibly be more than 1ns)

- [X] Integration test

N/A, unable to write (function could possibly be more than 1ns)

- [X] Documentation

**How to test changes / Special notes to the reviewer:**

```
odo create nodejs foobar
odo push
```

And you should see that all nanosecond spinners are no longer shown.

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2022-03-18 11:44:43 +01:00
Parthvi Vala
ce9506ded9 Add more verbosity to undeploy (#5340)
* Add more verbosity to undeploy

* Fix stdout messages for odo delete

* Fix styling for odo delete

* Update pkg/devfile/adapters/kubernetes/component/adapter.go

Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>

* Fix typo

Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
2022-01-19 07:22:59 -05: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
Dimitra Zuccarelli
511673f19b Remove experimental mode flag (#5117)
* Remove experimental mode flag

Signed-off-by: dimitraz <dimitrazuccarelli@gmail.com>

* Remove unused function

Signed-off-by: dimitraz <dimitrazuccarelli@gmail.com>

* Update example strings for url and push commands

* Update watch tests

Signed-off-by: dimitraz <dimitrazuccarelli@gmail.com>
2021-10-11 08:33:46 +02:00
Mohammed Ahmed
44d12d3241 Adding deprecation warning for git based registries (#4707)
* Adding deprecation warning for git based registries

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding tests for deprecation warning for git based registry

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding changelog

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing gofmt

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing gofmt

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving color sprint funcions inside if block

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unnessasary comment

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Expanding url matching for github to github.com

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Combining outputs of out and err for matching

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding raw githubusercontent to git registry check

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing as per comments by @valaparthvi

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving declarations to just before each

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
2021-05-19 09:02:03 -04:00
Aditi Sharma
c194899343 Add Support for specifying git branch and tag in devfile (#4260)
* Update go-git

* Add support for specifying branch and tag name

* Fix gosec error
Fix Integration test

* Added warning if commit id is used as revision

Added Integration tests

* fix devfile

* Fix failing test update tag version

* Address review comment 1
2020-12-07 17:52:55 -05:00
Chris Laprun
fcaafa2fc8 fix: typos [skip-ci] (#4158)
* fix: typos [skip-ci]

* fix: typo [skip-ci]
2020-10-28 20:21:51 -04:00
Chris Laprun
412f588e59 refactor: simplify execution of devfile commands (#3596)
* refactor: simplify execution of devfile commands

Fixes #3518

* fix: remove mistakenly re-added PlatformAdapter interface

* refactor: move catalog list output to where it's actually needed

This simplifies the package organization by avoiding to import catalog-
related packages in the lower-level machine output package.

* feat: add LoggingClient method on ComponentAdapter interface

* refactor: rename all receivers similarly

* fix: typo

* refactor: ComponentAdapter implements ExecClient, simplify Execute

* fix: typo

* refactor: introduce GenericAdapter to share more code

* chore: remove now unneeded methods

* fix: update from master

* fix: improper code to ExecuteCommand

* fix: properly initialize Client in adapters

* fix: update tests

* chore: add docs [skip ci]

* refactor: expose component info factory methods

* feat: add ExplicitSpinner function

* refactor: simplify adapters using NewMachineEventLoggingClient factory

* refactor: introduce command concept following the composite pattern

Still needs a lot of work to accommodate composite-support changes

* refactor: re-implement command execution using composite commands

* refactor: re-organize command implementations in multiple files

* doc: document New and command

* fix: typo

* fix: change var name

* fix: improper check for composite command

* clean-up: unneeded code

* refactor: rename ExecuteDevfileCommandSynchronously more appropriately

* chore: re-add some tests

* fix: init the ComponentInfoFactories after the GenericAdapter is created

This is needed because the previous implementation resulted in the
componentInfo and supervisorComponentInfo variables capturing
uninitialized adapters and thus causing errors.

* chore: add documentation

* fix: use Errorf instead of Wrapf since there is no error to wrap

* fix: infinite loop

* fix: do not report an error if the supervisor container is not found

* fix: only start the supervisor if we found its container

* fix: remove redundant check

* fix: supervisor commands now use proper component info

Introduced newSupervisor*Command to encapsulate supervisor command
details.

* fix: do not add to composite if supervisor command is nil

* fix: supervisor start/stop should be more like regular simple commands

* fix: add newline at the end of output

* doc: add documentation

[skip ci]

* refactor: rename createFrom to createCommandFrom

* refactor: make sourcePath a const and move it where it's used

* fix: comment out failing tests

See #3685

* fix: typo

* doc: clarify simpleCommand's behavior with respect to commands

[skip ci]

* feat: do not show spinner if message is empty

* fix: do not show spinner for stop command

* fix: remove unneeded fmt.Sprintf call

* chore: update after rebase
2020-08-06 22:17:15 -04:00
Jonathan West
57b880140e Build progress does not show correctly when the command line is too long (#3374)
* Build progress does not show correctly when the command line is too long

* Build progress does not show correctly when the command line is too long

* Build progress does not show correctly when the command line is too long

* Build progress does not show correctly when the command line is too long
2020-06-26 14:43:11 -04:00
Jonathan West
15cf870edf Invalid ANSI colouring on Windows when doing devfile push (#3327) 2020-06-24 16:20:19 -04:00
Charlie Drage
f47c9c9f4c Adds disclaimer that experimental mode is enabled (#2786)
**What type of PR is this?**

/kind documentation

**What does does this PR do / why we need it**:

Adds a disclaimer that experimental mode is enabled when using `odo
create` or `odo push`.

See asciinema:

[![asciicast](https://asciinema.org/a/A6ITI1wNQL9hahhLsCz4DT6wQ.svg)](https://asciinema.org/a/A6ITI1wNQL9hahhLsCz4DT6wQ)

**Which issue(s) this PR fixes**:

N/A

**How to test changes / Special notes to the reviewer**:

```sh
odo preference set experimental true
git clone https://github.com/openshift/nodejs-ex
odo create nodejs
odo push
```

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2020-04-08 23:22:30 +02:00
Charlie Drage
6112ed2833 Adds event information when waiting for a pod (#2627)
**What type of PR is this?**
/kind feature

**What does does this PR do / why we need it**:

This PR:
  - Adds more information when deploying via "WaitAndGetPod". We parse
  the current events which are happening and then look for event counts
  which have occured more than 5 times. We then output this information
  with the spinner in order to help the user determine what's taking so
  long to deploy
  - Collect event information that's outputted when it fails with a
  table.
  - Changes how we output errors

Example outputs:

```sh
▶ odo push -f
Validation
 ✓  Checking component [122ms]

Configuration changes
 ✓  Initializing component
 ✓  Creating component [733ms]

Pushing to component nodejs-nodejs-ex-dorv of type local
 ✗  Waiting for component to start [5s]

ERROR:
waited 5s but was unable to find a running pod matching selector: 'deploymentconfig=nodejs-nodejs-ex-dorv-app'
```

```sh
~/openshift/nodejs-ex  master ✗                                                                                                                                                                                                                                                                                                                                    28d ⚑ ◒
▶ odo push -f
Validation
 ✓  Checking component [134ms]

Configuration changes
 ✓  Initializing component
 ✓  Creating component [417ms]

Pushing to component nodejs-nodejs-ex-dorv of type local
 ✗  Waiting for component to start [5s] [WARNING x5: FailedScheduling, use `-v` for more information.]

ERROR:
waited 5s but was unable to find a running pod matching selector: 'deploymentconfig=nodejs-nodejs-ex-dorv-app'
For more information to help determine the cause of the error, re-run with '-v'.
See below for a list of failed events that occured more than 5 times during deployment:
+----------------------------------------------------+-------+------------------+-------------------------------------+
|                        NAME                        | COUNT |      REASON      |               MESSAGE               |
+----------------------------------------------------+-------+------------------+-------------------------------------+
| nodejs-nodejs-ex-dorv-app-1-r46cg.15f66f7d73693e5c |    15 | FailedScheduling | persistentvolumeclaim               |
|                                                    |       |                  | "nodejs-nodejs-ex-dorv-app-s2idata" |
|                                                    |       |                  | not found                           |
| nodejs-nodejs-ex-dorv-app-1-vn8vd.15f66f8482ee88f6 |     5 | FailedScheduling | persistentvolumeclaim               |
|                                                    |       |                  | "nodejs-nodejs-ex-dorv-app-s2idata" |
|                                                    |       |                  | not found                           |
+----------------------------------------------------+-------+------------------+-------------------------------------+
```

**Which issue(s) this PR fixes**:

Fixes https://github.com/openshift/odo/issues/2244

**How to test changes / Special notes to the reviewer**:

Run a test application like so:

```sh
git clone https://github.com/openshift/nodejs-ex
odo create node js
odo preference set PushTimeout
watch -n 1 oc delete pvc --all
odo push -f
```
2020-03-18 00:09:11 +01:00
Tomas Kral
1d8f8e4f48 cleanup OWNERS file (#2442) 2019-12-11 10:01:20 +01:00
Charlie Drage
ff14e02c02 Add italic font when describing what to do next (#2348)
**What kind of PR is this?**
<!--
DELETE the kind(s) which are not applicable before opening the PR.
-->

/kind code refactorting
/kind docs
/kind enhancement

**What does does this PR do / why we need it**:

This PR:
 - Adds italic font when outputting what to "do next". Essentially, when
 using log.Info it's for a "bold" or "title" log. When using log.Italic
 it's mainly used for when we want to say to the user what to do next,
 such as using `odo push` to propagate changes
 - Removes random periods which aren't suppose to be there (all output
 should not be sentences with periods)

**Which issue(s) this PR fixes**:

N/A

**How to test changes / Special notes to the reviewer**:

Run: `odo create nodejs` or any other similar commands, such as `odo
url create` which have "next steps" in them.

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2019-11-15 15:15:24 +01:00
Charlie Drage
73a8498450 Updates odo describe output (#2231)
Updates the `odo describe` output to be a bit more intuitive / better
looking.
2019-10-07 01:26:15 -07: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
387145f5bc Adds odo create project -o json output (#1916)
Adds machine readable output for odo create project.

To test:

```sh
odo create project -o json
```
2019-08-22 19:04:07 +02:00
Charlie Drage
dd181e658a Make --output a global parameter, disable logging, fix bug (#1898)
This PR:
- Makes `-o` or `--output` a global parameter
- Disables logging completely when performing `-o json`, including
using verbosity `-v`
- Fixes a minor bug within some commands where `-o json` wasn't
detected corretly due to a local flag being used `outputFlag` rather
than `OutputFlag`
2019-07-30 19:30:25 +02:00
Charlie Drage
20a31d6cb4 Switch to using string-based formatting for time elapsed (#1824)
* Switch to using string-based formatting for time elapsed

This PR:
  - Uses string based formatting for the time
  - No longer uses "%v" with time.Duration, so there are no
  false-positives when displaying the time

Closes https://github.com/openshift/odo/issues/1811

* Start time not being set in verbose
2019-06-25 17:00:56 +02:00
Charlie Drage
5349f570dc List apps deployed via servers within odo app list (#1809)
* List apps deployed via servers within odo app list

This PR:
  - Updates `odo app list` to also include services
  - Adds tests to both GetDeploymentConfigLabelValues as well as
  GetServiceInstanceLabelValues

To replicate:

```sh
▶ ./odo app list
The project 'myproject' has the following applications:
NAME
app
app2
```

Closes https://github.com/openshift/odo/issues/1730

* Change wording
2019-06-19 13:53:38 +02:00
Charlie Drage
422cdb59cf Adds a timer to UI / UX output (#1795)
* Adds a timer to UI / UX output

Adds a timer to the UI / UX:

```sh
Validation
 ✓  Validating component [5s]
 ✓  Checking component [6s]

Configuration changes
 ✓  Applying configuration [808ms]

Applying URL changes
 ✓  URL myurl2 already exists

Pushing to component nodejs-lhov of type local
 ✓  Waiting for component to start [61ms]
 ✓  Copying files to component [3s]
 ✓  Building component [6s]
 ✓  Changes successfully pushed to component
```

Closes https://github.com/openshift/odo/issues/1726

* Update based on feedback
2019-06-11 00:12:07 +02:00
Charlie Drage
9d1672bdfe Fixes issue of odo login not working correctly (#1652)
* Fixes issue of odo login not working correctly

This fixes the issue of `odo login` not working correctly.

In this PR:
  - Added logging for before AND after
  - Changed stdout / stderror to the correct ones from odolog package
  - Fix up success output
  - Added Success function to odolog

Closes issue https://github.com/openshift/odo/issues/1643

* Fix error and colouring

* Re-add the color

* Fix other error

* Adds another fix with regards to filtering messages

* Remove color

* Add another filter
2019-05-12 09:46:22 +02:00
Charlie Drage
0e53afebfa Adds --show-log to odo push (#1275)
Adds a --show-log parameter to `odo push` in order to see the log while
building.

Closes #1058
2019-03-27 11:14:01 -07: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
Charlie Drage
10b8152617 Adds color support for Windows (#1211)
* Vendoring for go-colorable

* Adds color support for Windows

This fixes the issue of ASCII characters not appearing correctly for
Windows users.

Changes with this PR:
- Odo will detect if Windows is used and use a non-Unicode spinner.
- Odo will also use "X" and "V" to indicate success and unsuccessful on Windows since "✓" is Unicode.

Closes issue: #https://github.com/redhat-developer/odo/issues/1072
2019-03-17 23:07:12 -07:00
Charlie Drage
690c76c013 Removes unnecessary newlines / outputs (#1303)
Removes all unnecessary newlines that were added, this was caused by not
accounting `Sprintln` (which includes a newline...)

Changes:

```sh
github.com/redhat-developer/odo  remove-newline-error ✗                                                                                                                                                                                                                   1d ⚑  ⍉
▶ ./odo create nodejs
 ✗  unable to get current application

github.com/redhat-developer/odo  remove-newline-error ✗                                                                                                                                                                                                                   1d ⚑  ⍉
▶ make bin
go build -ldflags="-w -X github.com/redhat-developer/odo/pkg/odo/cli/version.GITCOMMIT=57603295" -o odo cmd/odo/odo.go

github.com/redhat-developer/odo  remove-newline-error ✗                                                                                                                                                                                                                    1d ⚑
▶ ./odo create nodejs
 ✗  unable to get current application
```

As well as for other output messages:

```sh
github.com/redhat-developer/odo  remove-newline-error ✗                                                                                                                                                                                                                    1d ✚
▶ ./odo push
Pushing changes to component: odo-nodejs-pjfp
 ✓  Waiting for pod to start
 ✓  Copying files to component
 ◐  Building component ✗  Unable to build files
+ set -eo pipefail
+ '[' '!' -z /opt/app-root/src ']'
+ '[' /tmp '!=' /opt/app-root/src ']'
+ '[' /opt/app-root/src '!=' /opt/app-root/src ']'
+ '[' -f /tmp/src/.s2i/bin/assemble ']'
+ '[' -n /usr/libexec/s2i ']'
+ rm -rf /opt/app-root/src/.git
+ /usr/libexec/s2i/assemble
---> Installing application source
---> Building your Node application from source
Current git config
url.https://github.com.insteadof=git@github.com:
url.https://.insteadof=ssh://
url.https://github.com.insteadof=ssh://git@github.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:cdrage/odo.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.namespace-components.remote=origin
branch.namespace-components.merge=refs/heads/namespace-components
branch.add-logs.remote=origin
branch.add-logs.merge=refs/heads/add-logs
remote.upstream.url=git@github.com:redhat-developer/odo.git
remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
branch.gh-pages.remote=upstream
branch.gh-pages.merge=refs/heads/gh-pages
travis.slug=cdrage/odo
---> Installing dependencies
internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module './package.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at [eval]:1:13
    at Script.runInThisContext (vm.js:96:20)
    at Object.runInThisContext (vm.js:303:38)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at evalScript (internal/bootstrap/node.js:582:27)

 ✗  Building component
 ✗  command terminated with exit code 1
```
2019-03-04 14:09:12 +01:00
Mohammed Ahmed
3b7b1789c0 Fix #1400 : Adding prow style OWNERS files (#1402)
* Fix #1400 : Adding prow style OWNERS files

This PR adds OWNERS files to enable prow to ping appropriate people
and decide whose PRs warrant automatic merge

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing kadel from tests
2019-03-04 12:00:00 +05:30
amitkrout
d82c1eaf28 Issue #1205 Update test suite to handle stderr (#1307) 2019-02-14 12:13:51 +01:00
Charlie Drage
75d3527642 Updates the spinner output and refactors prefix/suffix spacing (#1228)
This PR updates the spinner so it now uses "◐◓◑◒" icons in order to not
only switch to ASCII only (since ◐◓◑◒ keys are ASCII), but to also
reduce the amount of spacing needed for everything to format correctly.

Previously, the spinner was using 2 character spaces, this will now only
use 1 character space. This will make the logging more "concise" and
appear more compact.

For example:

```sh
▶ ./odo create nodejs --git https://github.com/openshift/nodejs-ex
 ✓  Checking component
 ✓  Checking component version
 ✓  Creating component nodejs-ex-nodejs-jkzn
 ◑  Triggering build from git
```
2019-01-24 10:04:12 +01:00
Charlie Drage
422b92ea80 Switch the output to all checkmarks / x's (#1080)
This changes the output to use all checkmarks / X's instead of OK and
ERR.

Closes https://github.com/redhat-developer/odo/issues/1078
2018-12-05 10:59:15 +01:00
Charlie Drage
5622eb92ba Add loading progress / revamped UX for logging (#983)
Adds a loading progress when deploying containers (in particular,
pushing..)

Revamps the logging so it's more "modern" and cleaner.
2018-11-30 10:35:08 -05:00