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

Refacto odo dev #6141

Merged
merged 8 commits into from
Sep 22, 2022
Merged

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Sep 20, 2022

What type of PR is this:

/kind cleanup

What does this PR do / why we need it:

Which issue(s) this PR fixes:

Part of #5865
Fixes #6159

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

@openshift-ci
Copy link

openshift-ci bot commented Sep 20, 2022

@feloy: The label(s) kind/cleanup cannot be applied, because the repository doesn't have them.

In response to this:

What type of PR is this:

/kind cleanup

What does this PR do / why we need it:

Which issue(s) this PR fixes:

Part of #5865

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@netlify
Copy link

netlify bot commented Sep 20, 2022

Deploy Preview for odo-docusaurus-preview ready!

Name Link
🔨 Latest commit 055f92c
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/632c458071842700090fdfc8
😎 Deploy Preview https://deploy-preview-6141--odo-docusaurus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@odo-robot
Copy link

odo-robot bot commented Sep 20, 2022

Unit Tests on commit 16c8d56 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Sep 20, 2022

Validate Tests on commit 16c8d56 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Sep 20, 2022

OpenShift Tests on commit 16c8d56 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Sep 20, 2022

Kubernetes Tests on commit 16c8d56 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Sep 20, 2022

Windows Tests (OCP) on commit 16c8d56 finished successfully.
View logs: TXT HTML

@feloy feloy requested review from rm3l and valaparthvi and removed request for dharmit and cdrage September 22, 2022 06:46
Copy link
Contributor

@valaparthvi valaparthvi left a comment

Choose a reason for hiding this comment

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

Nice refactor!

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

dharmit commented Sep 22, 2022

Fixes #6159

How do we know that the PR fixes this issue? Have we tried this with podman?

@feloy
Copy link
Contributor Author

feloy commented Sep 22, 2022

Fixes #6159

How do we know that the PR fixes this issue? Have we tried this with podman?

If you look at the code into pkg/odo/cli/dev, you should not see any code related to Kubernetes (1).

Also, into the interface definition in pkg/dev, no parameter of the methods should be related to Kubernetes.

(1) There is still a problem about calling:

o.clientset.KubernetesClient.SetNamespace(o.GetProject())

but this is a generic problem how we are managing the context, not specific to the odo dev command.

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.

LGTM - thanks for this!

Added a few nitpicky comments.

pkg/dev/dev.go Outdated
"io"

"github.com/redhat-developer/odo/pkg/binding"
"github.com/redhat-developer/odo/pkg/envinfo"
"github.com/redhat-developer/odo/pkg/kclient"
"github.com/redhat-developer/odo/pkg/portForward"
"github.com/redhat-developer/odo/pkg/preference"
"github.com/redhat-developer/odo/pkg/testingutil/filesystem"
filesystem "github.com/redhat-developer/odo/pkg/testingutil/filesystem"
Copy link
Member

Choose a reason for hiding this comment

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

nit: is this import alias needed? I find it a bit redundant.
https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#import-aliasing


// Watch watches for any changes to the files under path while ignoring the files/directories in ignorePaths.
//
// It then watches for any changes to the files under path while ignoring the files/directories in ignorePaths.
// It logs messages to out and uses the Handler h to perform push operation when anything changes in path.
// It uses devfileObj to notify user to restart odo dev if they change endpoint information in the devfile.
// If debug is true, the debug command will be started after a sync, or the run command by default.
// If buildCommand is set, this will look up the specified build command in the Devfile. Otherwise, it uses the default one.
// If runCommand is set, this will look up the specified run command in the Devfile and execute it. Otherwise, it uses the default one.
// componentStatus is the status returned from the call to the Start Method
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the doc about componentStatus since it is not a parameter of Start?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have also rewritten the doc

pkg/dev/interface.go Outdated Show resolved Hide resolved
pkg/dev/dev.go Show resolved Hide resolved
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Sep 22, 2022
@feloy feloy requested review from rm3l and dharmit September 22, 2022 11:22
@sonarcloud
Copy link

sonarcloud bot commented Sep 22, 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 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dharmit
Copy link
Member

dharmit commented Sep 22, 2022

Thanks for the discussion and the work @feloy.

/lgtm

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

rm3l commented Sep 22, 2022

/approve

@openshift-ci
Copy link

openshift-ci bot commented Sep 22, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rm3l

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 Sep 22, 2022
@feloy
Copy link
Contributor Author

feloy commented Sep 22, 2022

/override ci/prow/v4.11-integration-e2e

Tests pass on IBM Cloud

@openshift-ci
Copy link

openshift-ci bot commented Sep 22, 2022

@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.11-integration-e2e

In response to this:

/override ci/prow/v4.11-integration-e2e

Tests pass on IBM Cloud

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@feloy
Copy link
Contributor Author

feloy commented Sep 22, 2022

/override ci/prow/v4.11-integration-e2e
Tests pass on IBM Cloud

@openshift-ci
Copy link

openshift-ci bot commented Sep 22, 2022

@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.11-integration-e2e

In response to this:

/override ci/prow/v4.11-integration-e2e
Tests pass on IBM Cloud

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-merge-robot openshift-merge-robot merged commit aaf64c5 into redhat-developer:main Sep 22, 2022
kadel pushed a commit to kadel/odo that referenced this pull request Oct 3, 2022
* Move Dev Handler to specific file

* Do not pass unnecessary namespace to Dev package

* Pass FS with dependency injection

* Merge Dev.Start and Dev.Watch

* Simplify Handler

* Move Dev Handler inside the Dev package

* Update mock

* Review
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.

Make pkg/dev platform agnostic
5 participants