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.
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.
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.jswill be synchronized to/usr/src/app/baz/bot/test.js.Given:
and changing
my/src.txt,src.txtwill 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 PRwill take precedence over thev0.23.0line (triple-stars are matched first before other patterns), except when running a version of Skaffold before this PR. In that case, thev0.23.0line will be used, and onlyv0.23.0will produce the same behaviour as this PR.Hope this helps,
Michael.