-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Preserve sync subtree for '***'. #1813
Conversation
pkg/skaffold/sync/sync.go
Outdated
if isTripleStar { | ||
// Map the paths as a tree from the prefix. | ||
subtreePrefix := strings.Split(p, "***")[0] | ||
subPath = strings.TrimPrefix(relPath, subtreePrefix) |
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.
Need:
filepath.FromSlash(subtreePrefix)
Otherwise the prefix-pruning fails on Windows.
Codecov Report
@@ Coverage Diff @@
## master #1813 +/- ##
=========================================
+ Coverage 45.54% 45.75% +0.2%
=========================================
Files 143 143
Lines 6683 6723 +40
=========================================
+ Hits 3044 3076 +32
- Misses 3333 3338 +5
- Partials 306 309 +3
Continue to review full report at Codecov.
|
Thank you for the bug fix! The kokoro job failed due to intergration test flakiness #1538. |
@tejal29 I implemented your proposed changes. I found and fixed some test failures with absolute paths on Windows. Would you mind please relabeling |
doubleStarPattern[p] = dst | ||
} | ||
} | ||
return |
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.
Thanks, i never knew you can return like this in go.
Fixes #1807
This PR implements subtree syncing for '***' globs in the sync specification.
Given:
and changing
foo/baz/bot/test.js
,test.js
will be synchronized to/usr/src/app/baz/bot/test.js
.Given:
and changing
my/src.txt
,src.txt
will be synchronized to${WORKDIR}/subdir/my/src.txt
.All the existing sync specs in 0.25.0 mean the same as they did before this PR (i.e. they collapse the subPath, so all files in the subtree are synced to the same destination directory, not its children). To allow for backward compatibility with 0.23.0's subtree syncing, you can use:
The line marked
this PR
will take precedence over thev0.23.0
line (triple-stars are matched first before other patterns), except when running a version of Skaffold before this PR. In that case, thev0.23.0
line will be used, and onlyv0.23.0
will produce the same behaviour as this PR.Hope this helps,
Michael.