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

Port over odo parser #34

Merged
merged 42 commits into from
Oct 28, 2020
Merged

Port over odo parser #34

merged 42 commits into from
Oct 28, 2020

Conversation

yangcao77
Copy link
Collaborator

What does this PR do?

This PR moves the parser pkg from Odo repo to devfile/parser, and integrates with latest devfile go structs defined in devfile/api

What issues does this PR fix or reference?

Fixes devfile/api#183

Is your PR tested? Consider putting some instruction how to test your changes

Tested by running the unit tests within this PR.

yangcao77 and others added 23 commits September 29, 2020 16:14
Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Maysun J Faisal <[email protected]>
Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Maysun J Faisal <[email protected]>
Signed-off-by: Maysun J Faisal <[email protected]>
Signed-off-by: Maysun J Faisal <[email protected]>
Signed-off-by: Maysun J Faisal <[email protected]>
Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Maysun J Faisal <[email protected]>
Copy link
Collaborator

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

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

In general I think it's a bad idea to have no-logic getters on exported fields (e.g. return d.Parent) unless we can justify more complicated logic in the future.

@yangcao77
Copy link
Collaborator Author

@amisevsk they reason why we have those Get() functions is because information like d.component is not exposed in devfileObj which consumers will get after parsing. They can only use interface defined in devfileData to access the struct.
This is how the initial devfile parser was implemented, and is how odo currently using and implemented.

@@ -0,0 +1,10 @@
package parser
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should FakeContext be move to testingutil package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

all fields inDevfileCtx are defined as internal, and cannot be accessible outside of the context package

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right. Let's move FakeContext() to xxx_test.go so that it is not visible outside of tests. Also, we should consider not exporting this function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree we should rename the file to avoid confusion.
The function should be kept as exported, because consumers(like odo) would need that function for their testing purpose.

@kadel
Copy link
Member

kadel commented Oct 21, 2020

I don't thing that this is a good approach.

I was under assumption that we have agreement on evolving and doing all necessary changes to parser in odo repo first, and then once we have independent parser package in odo we extract it from odo and put it here.
If we start evolving parser package like this in a separate repo odo and this parser package will drift apart and we will never be able to switch to this.

The first step was supposed to be in a the opposite direction. If there are additional things in devfile/parser that are not in odo it should be added into odo parser package.

@wtam2018
Copy link
Collaborator

When will odo parser finish with evolving?

@kadel
Copy link
Member

kadel commented Oct 21, 2020

I don't thing that this is a good approach.

I was under assumption that we have agreement on evolving and doing all necessary changes to parser in odo repo first, and then once we have independent parser package in odo we extract it from odo and put it here.
If we start evolving parser package like this in a separate repo odo and this parser package will drift apart and we will never be able to switch to this.

The first step was supposed to be in a the opposite direction. If there are additional things in devfile/parser that are not in odo it should be added into odo parser package.

I haven't seen this issue on odo side before redhat-developer/odo#4117 (comment)
It addresses all my concerns. I just wanted to make sure that we don't have the same logic in odo and in devfile/parser.
The issue talks about using devfile/parser in odo. We just have to make sure that it happens right after this PR is merged.

Signed-off-by: Stephanie <[email protected]>
@johnmcollier
Copy link
Member

Should we be vendoring the go module dependencies here? Might be a good idea

@amisevsk
Copy link
Collaborator

IMO if we're going to start vendoring dependencies in this repo, it should be done in a separate PR.

@yangcao77
Copy link
Collaborator Author

yangcao77 commented Oct 22, 2020

@amisevsk I'm fine with either way. I will modify the commit history if we want to remove the vendor folder. I don't want the git history to be too big.
Is that the only concern from you?

@adisky And additional concerns?

I would like to get approval from you two before merging this PR.
Let me know if you found difficulty reviewing the PR due to the vendor folder. I will remove it if that's the case.

@adisky
Copy link

adisky commented Oct 23, 2020

I don't want the git history to be too big.

@yangcao77 To keep the history clean you can squash all the commits before merging

@adisky And additional concerns?

I would like to get approval from you two before merging this PR.
Let me know if you found difficulty reviewing the PR due to the vendor folder. I will remove it if that's the case.

For Porting purpose from odo to here, It is good to go from my side but more work needed to make it consumable as library
Logged two issues in devfile/api
devfile/api#194
devfile/api#193

@amisevsk
Copy link
Collaborator

If we're squashing this commit before merging then removing the vendoring is essential -- otherwise the commit that ends up in the history is completely useless from a history point of view. I have no problem with force-pushes to PR branches personally.

Vendor vs not vendor is a topic worth discussing and not something we should slide into a PR about something generally separate.

@yangcao77
Copy link
Collaborator Author

I do not want to squash all commit into one single commit, that would lose all commit history inside this PR.
Instead, I have removed the commits related to vendoring from commit history of the PR.
Let me know if you have any other concerns. @amisevsk

@yangcao77
Copy link
Collaborator Author

I'm going to merge this PR if no additional concerns have been raised end of Tuesday(EDT). We need this PR to proceed our next step. Thanks.

Copy link
Member

@maysunfaisal maysunfaisal left a comment

Choose a reason for hiding this comment

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

All the review comments were addressed for the PR

/lgtm

@yangcao77 yangcao77 merged commit 80c06b3 into devfile:master Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move the common library extracted from Odo to the devfile/parser repo
7 participants