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

Make the sync directory more consistent #3494

Closed
johnmcollier opened this issue Jul 6, 2020 · 2 comments · Fixed by #3662
Closed

Make the sync directory more consistent #3494

johnmcollier opened this issue Jul 6, 2020 · 2 comments · Fixed by #3662
Assignees
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/user-story An issue of user-story kind

Comments

@johnmcollier
Copy link
Member

Currently, odo uses the following logic for determining what folder to sync to:

  1. If a single project is defined in the devfile, it syncs to /projects/<projectName>
  2. If no projects are defined, or if there are multiple projects defined, it syncs to /projects
  3. (Most recently) If the sourceMapping field is set, it syncs to the folder specified.

The logic for 1 and 2 were in place because we wanted to maintain compatibility with Che devfiles initially, a number of which relied on the assumption that the code for a component would be under /projects/<projectName>. However, as it turned out, there would be a number of blockers that would prevent Che devfiles from working with odo. Additionally, this was before we had implemented support for source mapping, allowing the user to configure where the source gets synced to.

The downside to this current approach is that the expected sync directory isn't consistent for somebody writing a devfile, and as they add or remove projects from the devfile, the sync directory will change, potentially breaking the commands in their devfile each time.

@elsony @maysunfaisal and I chatted last week about this, and decided that long term, it would be better if odo always synced to /projects, unless the sourceMapping field is set, in which case, it will sync to the sourceMapping folder. This will ensure the sync directory is much more consistent and not subject to unwritten rules in odo.

@johnmcollier johnmcollier added area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/user-story An issue of user-story kind labels Jul 6, 2020
@johnmcollier johnmcollier self-assigned this Jul 6, 2020
@kadel
Copy link
Member

kadel commented Jul 8, 2020

@elsony @maysunfaisal and I chatted last week about this, and decided that long term, it would be better if odo always synced to /projects, unless the sourceMapping field is set, in which case, it will sync to the sourceMapping folder. This will ensure the sync directory is much more consistent and not subject to unwritten rules in odo.

+1 with one exception. If sourceMapping is not set it should check for PROJECTS_ROOT env variable and use that, and only if the PROJECTS_ROOT is not set then use /projects

This is my understanding based on how it is defined here: https://github.com/devfile/kubernetes-api/blob/80da7f73abaf7572c2bfb5c6dd1c1a696d2380b1/pkg/apis/workspaces/v1alpha1/containerComponent.go#L42-L46

@maysunfaisal
Copy link
Contributor

I think we should also consider the possibility of clonePath in projects.. If we're going to eventually support this property, we should take it into consideration with this issue

https://devfile.github.io/devfile/_attachments/api-reference.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/user-story An issue of user-story kind
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants