-
Notifications
You must be signed in to change notification settings - Fork 65
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
Remove GitHub projects #439
Conversation
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.
Seems tests needs to be adapted
schema_test.go:222: OVERALL FAIL : 34 of 291 tests failed.
but everything else LGTM
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: amisevsk, sleshchenko The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@amisevsk I have created a PR in your branch to fix the test failures, can you help review and merge if no issues with it: amisevsk#1 |
New changes are detected. LGTM label has been removed. |
@yangcao77 ahh sorry, I missed this comment until right after I pushed 18525d4 and 6726b05! I think I basically did the same thing as you :) |
@@ -19,8 +19,6 @@ func convertProjectTo_v1alpha2(src *Project, dest *v1alpha2.Project) error { | |||
switch { | |||
case src.Git != nil: | |||
sparseCheckoutDir = src.Git.SparseCheckoutDir | |||
case src.Github != nil: | |||
sparseCheckoutDir = src.Github.SparseCheckoutDir |
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.
since Github
is duplicate of Git
. Should we convert v1.Github
to v2.Git
, instead of ignoring it?
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.
Hm, this might be a good idea. My first impulse is to not do it since it would change the file on round trip (i.e. v1alpha1 (GitHub) -> v1alpha2 (Git) -> v1alpha1 (Git)
), but my approach of ignoring the problem just changes the file in a different way.
On the other hand, if there's not a whole lot of value in it, it's a lot simpler to not bother. The way conversion is implemented (round trip through json) would mean we'd have to do something fancy to make it work.
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.
emm. When you say "round trip conversion", did you mean how the conversion test is implemented?
I agree more extra work needs to be done if we want to test github->git conversion. however, the ConvertTo
(
api/pkg/apis/workspaces/v1alpha1/devworkspace_conversion.go
Lines 11 to 14 in a313872
func (src *DevWorkspace) ConvertTo(destRaw conversion.Hub) error { | |
dest := destRaw.(*v1alpha2.DevWorkspace) | |
return convertDevWorkspaceTo_v1alpha2(src, dest) | |
} |
what if we still convert
v1alpha1 (GitHub) -> v1alpha2 (Git)
in the actual conversion function, and just ignore Github
case in the conversion test?
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.
The way conversion is supposed to be implemented (from a k8s perspective) is that converting from version X to the hub version Y (v1alpha2 in our case) and back again should result in unmodified data. This is because internally, when you apply a v1alpha1 DevWorkspace to your cluster, kube will convert it to v1alpha2 and store that in etcd. This v1alpha2 spec is converted back to v1alpha1 when you request it from the cluster -- this is what the conversion tests are testing.
The way this is often done for removed/added fields is to serialize removed fields into a json annotation so that when you unconvert you get the same data, but IMO this is a very messy approach for a feature nobody is using (i.e. a bunch of work for no gain). We've done a similar thing for e.g. the vscode command types.
The additional work that would be required to implement GitHub -> Git conversion is due to the approach we take to conversion, where we take version X, serialize it to json, and then deserialize it to version Y (e.g. here). This was done since the main breaking change between v1alpha1 and v1alpha2 is moving component name, command id, etc. one level higher in the spec (i.e. .spec.components[].name
vs .spec.components[].container.name
, which makes the types not assignable and makes conversion-gen code nearly useless. By going through json, we can easily assign all fields shared between v1alpha1 and v1alpha2, but this doesn't work if the path is different (a GitHub project -- e.g. .projects[].github.remotes
-- will deserialize to nil if you pass in a Git
project).
I can definitely look into it, but I'm hesitant to introduce complexity in the conversion code to cover a case that (I think) will never actually be called in production.
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'm thinking if adding an attribute when convert Github -> Git would help in this situation?
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 finally got around to this: 45b3cff
Please take a look.
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.
The basic gist of the approach is
v1alpha1 | intermediate (v1alpha1) | v1alpha2
-----------------------------|--------------------------------|--------------------------------
projects: | projects: | projects:
- name: project | - name: project | - name: project
github: | github: |
remotes: | remotes: |
origin: my-url.com | origin: my-url.com |
| git: | git:
| remotes: | remotes:
| origin: my-url.com | origin: my-url.com
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
6726b05
to
9d476bc
Compare
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.
changes looks good to me
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: amisevsk, sleshchenko, yangcao77 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Angel Misevski <[email protected]>
When converting a devfile in v1alpha1 that contains projects with type Github, convert those projects to Git-type projects in v1alpha2 and apply attribute 'conversion.api.devfile.io/converted-from=GitHub' to them. When converting from v1alpha2, convert Git-type projects with the above attribute back to Github-type projects in v1alpha1. Reenable testing conversion for Github-type projects in v1alpha1 now that it is supported. Signed-off-by: Angel Misevski <[email protected]>
6126fb6
to
d2c5a8f
Compare
New changes are detected. LGTM label has been removed. |
What does this PR do?
Remove projects with type
GitHub
, since this duplicatesGit
-type projects.I'm not sure this PR should be merged now, as
GitHub
projects were deprecated on Feb 19 but I think it makes sense to include this in the 2.1 milestone as the change will be required by the timev1alpha2
is set (since it's a k8s-incompatible change -- doing it later would require going tov1alpha3
). As far as I know, no devfiles/DevWorkspaces useGitHub
projects so no use cases should be broken.What issues does this PR fix or reference?
Fixes #340
Is your PR tested? Consider putting some instruction how to test your changes
Fixed conversion tests to ignore GitHub projects.