-
Notifications
You must be signed in to change notification settings - Fork 274
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
fix(sync-mode): use the same source path schemas for all action types #5363
Conversation
sourcePath
schemas for all action typessourcePath
schemas for all action types
sourcePath
schemas for all action typesa6c4ced
to
40ec1ea
Compare
core/src/plugins/container/config.ts
Outdated
.description( | ||
deline` | ||
POSIX-style or Windows-style local path of the directory to sync to the target. | ||
Can be either absolute or relative to the source directory where the Deploy action is defined. |
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.
Will a Windows-style relative path automatically be transformed to a Unix-path when you use the action on Linux or MacOS?
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 not both styles of writing the path work on all platforms, we should note that here.
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.
Good catch, thanks! I'll check if there are any advanced options to ensure that conversion. I hope it's doable.
Otherwise, we can implement it and apply it in all similar places.
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.
It looks like there is no way to do automatic conversion with joi. I've rewritten the docs in 59ca3ff. Now it says that the path should be in a platform-specific format.
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 not sure if platform-specific
is a good way to express this when Unix-paths will work under Windows.
Please correct me if I'm wrong, but I think the following statements are true:
- I am assuming here that windows-style paths won't work with Mutagen under Linux (Have we tested that though? If this assumption is false we are over-worrying here)
- The Unix-style paths with a forward slash (
/
) will work on Windows computers (I guess? Otherwise you can't use sync mode with coworkers on other platforms?) - Windows-style paths (with a backslash) won't be portable to Unix-like-systems like Linux or MacOS (Unless mutagen somehow will convert the paths?)
- Unix-style absolute paths won't be portable to Windows systems, and Windows-like absolute paths with a drive letter won't be portable to Unix-systems, obviously
My suggestion:
Path to a local local directory to be synchronized with the target.
Can be either absolute or relative to the source directory where the Deploy action is defined.
We recommend sticking with relative paths here, and using forward slashes (`/`) as a delimiter, as Windows-style paths with back slashes (`\`) and absolute paths will work on some platforms, but they are not portable and will not work for users on other platforms.
I have not tested the portability of using absolute paths and backslashes – have you?
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.
@stefreak right. Windows paths are not portable to Linux and Unix-like systems. Absolute POSIX paths are also not portable to Windows because of the drive letter format. Those can be used under WSL.
Relative POSIX-paths work well on Windows too. So that's the recommended setup. Thanks for the suggestion.
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.
Updated it in 13fd82c.
Pull request was converted to draft
40ec1ea
to
c7c016a
Compare
59ca3ff
to
13fd82c
Compare
2d332e5
to
13fd82c
Compare
What this PR does / why we need it:
This unifies the way we validate the sync mode's source paths for all action types.
Which issue(s) this PR fixes:
Fixes #4982
Fixes #5031
Special notes for your reviewer:
I tested and verified the changes on the Windows machine. I tried both relative and absolute Windows paths as a sync-mode source path.
I also added 2 test cases for Windows in 40ec1ea.
Verified the failure of those tests manually and in CI.
See individual commits for details.