update fsutil and docker#2486
Conversation
|
This is failing linting due to the deprecation that was added under docker/buildx#850 in particular under https://github.com/moby/moby/pull/43037/files#diff-709ecb416d43d86b2812c0eda71926f0af93cb7ef5f0486067a48e1e7ef90521R175 |
|
We should update contenthash to use the new methods and be consistent with fsutil, otherwise we may have cache inconsistencies. I can work on this and open a PR against your branch. |
If you're able to lend a hand with that, it would be greatly appreciated. Otherwise, I'm happy to give it a try, but might need some pointers. Are you suggesting we change the signature of |
|
I'll have time to do this tomorrow, but I'm also happy to do the code review if you want to give it a try.
|
|
@aaronlehmann Are there any actual cases where checksums on contenthash can change with this function switch? |
Only the cases where we're intentionally changing the include/exclude behavior (for example the scenario in docker/buildx#850) |
|
I think it's going to need some more work (maybe related to @tonistiigi 's question) as the tests are not happy. In particular I'm able to get this test to fail for me when I run it locally in this branch (where as it works on master): |
| if excludePatternMatcher != nil { | ||
| if parentDir != nil { | ||
| m, err = excludePatternMatcher.MatchesUsingParentResult(candidate, parentDir.matchedExcludePattern) | ||
| m, matchInfo, err = includePatternMatcher.MatchesUsingParentResults(candidate, parentDir.excludeMatchInfo) |
There was a problem hiding this comment.
This should be excludePatternMatcher, not includePatternMatcher. Same two lines below. Didn't catch this in the first review.
There was a problem hiding this comment.
Unfortunately, there is a bug in MatchesUsingParentResults. I opened moby/moby#43047 to fix it. We'll need to get that merged and then revendor.
|
In addition to the two things I pointed out, there is one more change we should make here. The code is currently clearing buildkit/cache/contenthash/checksum.go Lines 667 to 677 in 159bb1e should change to: if shouldInclude {
for _, parentDir := range parentDirHeaders {
if !parentDir.included {
includedPaths = append(includedPaths, parentDir)
parentDir.included = true
}
}
includedPaths = append(includedPaths, maybeIncludedPath)
maybeIncludedPath.included = true
}
if cr.Type == CacheRecordTypeDirHeader {
// We keep track of parent dir headers whether
// they are immediately included or not, in case
// an include pattern matches a file inside one
// of these dirs.
parentDirHeaders = append(parentDirHeaders, maybeIncludedPath)
}(and add a boolean |
5bcd150 to
03eafb7
Compare
|
@alexcb: moby/moby#43047 was merged, so it should be possible to move forward with this. Let me know if you want me to carry the PR. |
update fsutil to include this patch: tonistiigi/fsutil@d952e50 docker also had to be updated due to tonistiigi/fsutil@2d121ce Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
switch to using newer MatchesUsingParentResults methods which were introduced in moby/moby#43037 Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
|
Thanks @aaronlehmann , I just opened up tonistiigi/fsutil#117 to pull those changes into fsutils, then once that's merged I'll pull that in here. |
03eafb7 to
6e3cdd4
Compare
update fsutils to 61a57076b9b065af88eb10f699926d7e8793910c which is required to pull in moby/moby#43047 Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
6e3cdd4 to
390c688
Compare
|
LGTM |
update fsutil to include this patch: tonistiigi/fsutil@d952e50
docker also had to be updated due to tonistiigi/fsutil@2d121ce
Signed-off-by: Alex Couture-Beil alex@earthly.dev