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

Implement new odo workflow for: odo watch #1446

Merged
merged 11 commits into from
Apr 5, 2019

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Mar 11, 2019

Implements odo watch by using the local configuration file.

To use these changes, simply use: odo watch in the same directory that
you've deployed, or odo watch --context ~/nodejs-ex.

This builds upon: #1360

Closes #1419

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. size/XXL labels Mar 11, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Mar 11, 2019
@cdrage cdrage added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Mar 11, 2019
@cdrage cdrage changed the title Implement new odo workflow for: odo watch [wip] Implement new odo workflow for: odo watch Mar 11, 2019
@cdrage
Copy link
Member Author

cdrage commented Mar 11, 2019

A lot of TODOs:

P.S: This is WIP / draft! Silly how you can't convert from a mergable PR to draft after pushing... oh well!

@cdrage cdrage closed this Mar 11, 2019
@cdrage cdrage reopened this Mar 11, 2019
@codeclimate
Copy link

codeclimate bot commented Mar 11, 2019

Code Climate has analyzed commit 2c2a679 and detected 20 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 8
Duplication 4
Style 6
Bug Risk 2

View more on Code Climate.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Mar 13, 2019
@cdrage cdrage changed the title [wip] Implement new odo workflow for: odo watch [WIP] Implement new odo workflow for: odo watch Mar 26, 2019
@openshift-ci-robot openshift-ci-robot added size/L and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. size/XXL labels Mar 27, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Mar 27, 2019
@cdrage
Copy link
Member Author

cdrage commented Mar 28, 2019

This is ready for review / testing / trying it out!

To test:

git clone https://github.com/openshift/nodejs-ex
odo create nodejs --context ~/nodejs-ex
odo push --context ~/node-js
odo watch --context ~/node-js

Same with --binary.

Examples below:

# Binary
▶ odo watch
Waiting for something to change in /home/wikus/example.war
File /home/wikus/example.war changed
Pushing files...
 ✓  Waiting for component to start
 ✓  Copying files to component
 ✓  Building component
Waiting for something to change in /home/wikus/example.war

# Local
▶ odo watch --context ~/nodejs-ex 
Waiting for something to change in /home/wikus/nodejs-ex
File /home/wikus/nodejs-ex/views/index.html changed
File /home/wikus/nodejs-ex/views/index.html~ changed
Pushing files...
Waiting for something to change in /home/wikus/nodejs-ex

@cdrage
Copy link
Member Author

cdrage commented Mar 28, 2019

@cdrage cdrage changed the title [WIP] Implement new odo workflow for: odo watch Implement new odo workflow for: odo watch Mar 28, 2019
@openshift-ci-robot openshift-ci-robot removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. labels Mar 28, 2019
Copy link
Contributor

@amitkrout amitkrout left a comment

Choose a reason for hiding this comment

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

My bad, could not realize the ping.

Can you please add a basic e2e watch test scenario as described in the pr description or you can update the commented scenario in the watch file

SourcePath string
LocalConfig *config.LocalConfigInfo
ComponentContext string
Client *occlient.Client
Copy link
Contributor

Choose a reason for hiding this comment

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

why client here again?
Almost every command generates context which already has client

)

// ComponentOptions are generic options that are used between commands such as watch and push
type ComponentOptions struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see it used anywhere in this PR in the git diff view shown here
And why have Sourcetype, SourcePath etc here ?
Is there any more processing to these than what can be fetched from LocalConfig?

// GetOSSourcePath corrects the current sourcePath depending on local or binary configuration,
// if Git has been passed, we simply return the source location from LocalConfig
// this will get the correct source path whether on Windows, macOS or Linux.
func GetOSSourcePath(localConfig *LocalConfigInfo) (path string, err error) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we align it with the rest of Get functions and use LocalConfig as a receiver?

func (lc *LocalConfig) GetOSSourcePath()

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@amitkrout
Copy link
Contributor

@amitkrout I already had an e2e_test.go created, but since we're refactoring e2e tests I won't be able to add it until #1535 is merged

Pr #1535 is merged, So please start adding watch test in new structure format.

@cdrage Can you pleas add the e2e test scenario in old format if you are not familiar enough with new test structure.

@amitkrout
Copy link
Contributor

@cdrage Please have a look at CI failures

@cdrage
Copy link
Member Author

cdrage commented Apr 4, 2019

Okay, will do @amitkrout 👍

@cdrage
Copy link
Member Author

cdrage commented Apr 4, 2019

@amitkrout @kadel

So I've updated this PR again, if you could have another look at it...

@kadel I was thinking of instead using a separate PR to fix the default behaviour that we talked about with regards to local and binary components. Essentially, saving the path as ./ instead of the absolute path in the configuration..

As of right now, this PR works wonderfully with Windows and fixes the issues with odo watch.

A few things however:

  • e2e tests are proving to be very difficult as I'm uncommenting all the odo watch e2e tests and encountering wayyyyyy too many errors, could we open up an issue and I write some e2e tests after e2e test: core scenario for beta #1559 is merged in?
  • I'll open up another issue with regards to changing the default behaviour with ./ absolute directory being saved instead of the actual directory.

WDYT @kadel ?

Please check out the new updated function too! ^^

Copy link
Contributor

@mik-dass mik-dass left a comment

Choose a reason for hiding this comment

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

Code LGTM 👍 and tested on Linux and it works. But some e2e tests would be really good.

Copy link
Contributor

@girishramnani girishramnani left a comment

Choose a reason for hiding this comment

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

If this resolves the SourceLocation issue on windows then can we refer that too here @cdrage

Copy link
Member

@syamgk syamgk left a comment

Choose a reason for hiding this comment

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

LGTM 👍

if sourceType == GIT {
glog.V(4).Info("Git source type detected, not correcting SourcePath location")
return sourceLocation, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

👍 I like that you didn't put else here ❤️

@amitkrout
Copy link
Contributor

e2e tests are proving to be very difficult as I'm uncommenting all the odo watch e2e tests and encountering wayyyyyy too many errors, could we open up an issue and I write some e2e tests after #1559 is merged in?

@cdrage No issue, please create an follow up issue for watch test only. Anyway the minimal watch test is handled by pr #1559 for beta release.

Copy link
Contributor

@amitkrout amitkrout left a comment

Choose a reason for hiding this comment

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

Approving this as the minimal watch test is taken care by #1559

@syamgk
Copy link
Member

syamgk commented Apr 5, 2019

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: syamgk

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Apr 5, 2019
@mik-dass
Copy link
Contributor

mik-dass commented Apr 5, 2019

/lgtm

@girishramnani
Copy link
Contributor

/hold cancel

@openshift-ci-robot openshift-ci-robot 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 5, 2019
@openshift-merge-robot openshift-merge-robot merged commit 2302e8d into redhat-developer:master Apr 5, 2019
@cdrage cdrage deleted the update-watch branch January 14, 2022 14:58
@rm3l rm3l added estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. and removed size/L labels Jun 18, 2023
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. estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. 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.