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 the error output for an empty directory #5610

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Mar 30, 2022

What type of PR is this:

What does this PR do / why we need it:

Updates the error output for running odo dev or odo deploy in an
empty directory. Telling the user to run the same command in a non-empty
dir, OR use odo init.

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:

Signed-off-by: Charlie Drage [email protected]

@netlify
Copy link

netlify bot commented Mar 30, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 46e8072
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/624490a9d4ad330008889970

@openshift-ci openshift-ci bot requested review from anandrkskd and dharmit March 30, 2022 17:06
@cdrage cdrage force-pushed the improve-error-output-for-empty-dir branch from 6b502d0 to 90c5bca Compare March 30, 2022 17:06
@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

Unit Tests on commit 3df1d73 finished successfully.
View logs: TXT HTML

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

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

Updates the error output for running `odo dev` or `odo deploy` in an
empty directory. Telling the user to run the same command in a non-empty
dir, OR use `odo init`.

**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 <[email protected]>
@cdrage cdrage force-pushed the improve-error-output-for-empty-dir branch from 90c5bca to 46e8072 Compare March 30, 2022 17:17
@sonarqubecloud
Copy link

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

@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

OpenShift Tests on commit 3df1d73 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

Kubernetes Tests on commit 3df1d73 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Mar 30, 2022

Validate Tests on commit 3df1d73 finished successfully.
View logs: TXT HTML

@@ -65,7 +65,7 @@ func (o *DeployOptions) Complete(cmdline cmdline.Cmdline, args []string) (err er
return err
}
if isEmptyDir {
return errors.New("this command cannot run in an empty directory, you need to run it in a directory containing source code")
return errors.New("this command cannot run in an empty directory, run the command in a directory containing source code or initialize using 'odo init'")
Copy link
Contributor

@valaparthvi valaparthvi Mar 31, 2022

Choose a reason for hiding this comment

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

Can't we define a sentinel error for this one in the component pkg? Something like the following -

var EmptyDirError := errors.New("this command cannot run in an empty directory, run the command in a directory containing source code or initialize using 'odo init'")

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey @valaparthvi I want to try and keep the error logging consistent across odo so I prefer not creating a sentinal error despite it being copy and pasted in two places...

Preferably because using those types of errors are unconventional and I want to make this PR more of a UI/UX change rather than adding to pkg/component instead of pkg/cli

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case,
/lgtm
/approve

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

openshift-ci bot commented Apr 1, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: valaparthvi

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 1, 2022
@openshift-merge-robot openshift-merge-robot merged commit 0d06d8e into redhat-developer:main Apr 1, 2022
cdrage added a commit to cdrage/odo that referenced this pull request Aug 31, 2022
<!--
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.
-->

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

Updates the error output for running `odo dev` or `odo deploy` in an
empty directory. Telling the user to run the same command in a non-empty
dir, OR use `odo init`.

**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 <[email protected]>
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. 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.

3 participants