Skip to content
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

Updates odo init output, fixes colorized output for tests. #5613

Merged

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Mar 30, 2022

What type of PR is this:

/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.

We also

  • Make sure that colorized output is DISABLED when running tests
  • Update the vendoring to enable NO_COLOR support
  • Fixes tests when comparing colorized output vs non-colorized.
$ 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:

N/A

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

N/A

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

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Mar 30, 2022
@netlify
Copy link

netlify bot commented Mar 30, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 01cbe6b
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/6255702f89d90200081fc5c0

@openshift-ci openshift-ci bot requested review from dharmit and feloy March 30, 2022 18:43
@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

Unit Tests on commit 238b02e finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

OpenShift Tests on commit 238b02e finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

Kubernetes Tests on commit 238b02e finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

Validate Tests on commit 238b02e finished successfully.
View logs: TXT HTML

@cdrage
Copy link
Member Author

cdrage commented Mar 31, 2022

/retest

@cdrage cdrage force-pushed the update-init-output branch 2 times, most recently from e501bd9 to 6caf0ba Compare April 4, 2022 12:06
@cdrage
Copy link
Member Author

cdrage commented Apr 4, 2022

/retest

@cdrage cdrage force-pushed the update-init-output branch 2 times, most recently from a386247 to ff4bda6 Compare April 4, 2022 18:18
@dharmit
Copy link
Member

dharmit commented Apr 5, 2022

Files: No source code detected, a starter project will be created in the current directory

This assumes that the user will always download a starter project, while they can choose not to do so. I am likely nitpicking, but felt like pointing out nevertheless.

@rm3l
Copy link
Member

rm3l commented Apr 5, 2022

@cdrage Indeed, it looks like the tests for this PR are not passing because of the welcoming messages added as part of #5514
Since the whole point of the issue reported (#5494) was to have such messages displayed first, I added tests that make sure such behavior is honored.
But I guess it should be ok to check that the first lines of the output contain the expected messages.

@cdrage
Copy link
Member Author

cdrage commented Apr 5, 2022

/hold

Trying to fix an issue with tests not passing...

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Apr 5, 2022
@cdrage cdrage changed the title Updates odo init output / adds logo Updates odo init output, fixes colorized output for tests. Apr 6, 2022
@cdrage cdrage removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Apr 6, 2022
@cdrage
Copy link
Member Author

cdrage commented Apr 6, 2022

/hold cancel

@rm3l rm3l self-requested a review April 6, 2022 14:41
Comment on lines 26 to 27
const NoSourceCodeDetected = "Files: Source code detected, a Devfile will be determined based upon source code autodetection"
const SourceCodeDetected = "Files: No source code detected, a starter project will be created in the current directory"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The names are misplaced.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops! Thank you

<!--
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>
Copy link
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added few comments. Let me know what you think.

pkg/component/component.go Outdated Show resolved Hide resolved
pkg/odo/cli/init/init.go Outdated Show resolved Hide resolved
pkg/log/status.go Show resolved Hide resolved
tests/helper/helper_interactive.go Outdated Show resolved Hide resolved
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
@sonarcloud
Copy link

sonarcloud bot commented Apr 12, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.7% 0.7% Duplication

Copy link
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 12, 2022
@feloy
Copy link
Contributor

feloy commented Apr 12, 2022

/approve

@openshift-ci
Copy link

openshift-ci bot commented Apr 12, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feloy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Apr 12, 2022
@openshift-merge-robot openshift-merge-robot merged commit 9c491b1 into redhat-developer:main Apr 12, 2022
cdrage added a commit to cdrage/odo that referenced this pull request Aug 31, 2022
…veloper#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants