-
Notifications
You must be signed in to change notification settings - Fork 244
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
Implement new odo workflow for: odo watch #1446
Conversation
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! |
Code Climate has analyzed commit 2c2a679 and detected 20 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
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 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
|
There was a problem hiding this 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
pkg/odo/genericclioptions/context.go
Outdated
SourcePath string | ||
LocalConfig *config.LocalConfigInfo | ||
ComponentContext string | ||
Client *occlient.Client |
There was a problem hiding this comment.
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
pkg/odo/genericclioptions/context.go
Outdated
) | ||
|
||
// ComponentOptions are generic options that are used between commands such as watch and push | ||
type ComponentOptions struct { |
There was a problem hiding this comment.
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?
pkg/config/config.go
Outdated
// 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) { |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@cdrage Can you pleas add the e2e test scenario in old format if you are not familiar enough with new test structure. |
@cdrage Please have a look at CI failures |
Okay, will do @amitkrout 👍 |
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 As of right now, this PR works wonderfully with Windows and fixes the issues with A few things however:
WDYT @kadel ? Please check out the new updated function too! ^^ |
There was a problem hiding this 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.
There was a problem hiding this 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
There was a problem hiding this 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 | ||
} |
There was a problem hiding this comment.
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 ❤️
@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. |
There was a problem hiding this 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
/approve |
[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 |
/lgtm |
/hold cancel |
Implements
odo watch
by using the local configuration file.To use these changes, simply use:
odo watch
in the same directory thatyou've deployed, or
odo watch --context ~/nodejs-ex
.This builds upon: #1360
Closes #1419