-
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
If clonePath is set, sync to it #2747
If clonePath is set, sync to it #2747
Conversation
Signed-off-by: John Collier <John.J.Collier@ibm.com>
Signed-off-by: John Collier <John.J.Collier@ibm.com>
/retest |
Codecov Report
@@ Coverage Diff @@
## master #2747 +/- ##
==========================================
- Coverage 43.72% 43.39% -0.33%
==========================================
Files 87 91 +4
Lines 8068 8233 +165
==========================================
+ Hits 3528 3573 +45
- Misses 4195 4309 +114
- Partials 345 351 +6
Continue to review full report at Codecov.
|
@johnmcollier Can you please add steps for how to validate this change with an example. Later we can think upon the possibility of integration test script. |
@amitkrout I've added instructions on how to validate. How to validate:
|
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.
Change looks good to me, thanks! lgtm
// If the clonepath is set to a value, set it to be the sync folder | ||
// As some devfiles rely on the code being synced to the folder in the clonepath | ||
if project.ClonePath != nil { | ||
return filepath.ToSlash(filepath.Join(kclient.OdoSourceVolumeMount, *project.ClonePath)) |
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.
There should be a check to prevent escaping /projects
or more precisely escaping from kclient.OdoSourceVolumeMount
( using ..
see: https://github.com/redhat-developer/devfile/blob/master/docs/devfile.md#clonepath
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.
Hmm, good catch.
How should we handle that? Che throws an error if the clonePath starts with either /
or ..
(https://github.com/eclipse/che/blob/420d4ea34cf50e5835027016211f16b02eba8a54/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/devfile/convert/ProjectConverter.java#L109). We should probably do the same.
Signed-off-by: John Collier <John.J.Collier@ibm.com>
@kadel Thanks for the review! I've updated the PR with changes to only allow relative clonePaths and to not allow |
projectNames := []string{"some-name", "another-name"} | ||
projectRepos := []string{"https://github.com/some/repo.git", "https://github.com/another/repo.git"} | ||
projectClonePath := "src/github.com/golang/example/" | ||
invalidClonePaths := []string{"/var", "../var", "pkg/../../var"} |
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.
👍
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel 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 |
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.
Adding lgtm label back since Tomas' comments have been addressed.
/retest Please review the full test history for this PR and help us cut down flakes. |
7 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
6 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Signed-off-by: John Collier John.J.Collier@ibm.com
What type of PR is this?
/kind bug
What does does this PR do / why we need it:
This PR updates the sync code to sync to the devfile's clonePath folder if it's set. Certain devfiles, such as the official Go devfile, rely on this field being set properly (see https://github.com/eclipse/che-devfile-registry/blob/5a41b4b0c85893a6ee99059fcceab35b8a71780c/devfiles/go/devfile.yaml#L46 for example)
Which issue(s) this PR fixes:
Fixes #2741