fix(lookupRemote): fixed lookup.go lookupRemote caching mechanism#9306
fix(lookupRemote): fixed lookup.go lookupRemote caching mechanism#9306idsulik wants to merge 3 commits into
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #9306 +/- ##
==========================================
- Coverage 70.48% 63.54% -6.94%
==========================================
Files 515 635 +120
Lines 23150 32799 +9649
==========================================
+ Hits 16317 20843 +4526
- Misses 5776 10347 +4571
- Partials 1057 1609 +552 ☔ View full report in Codecov by Sentry. |
f6463db to
5233baf
Compare
5233baf to
b85ab95
Compare
|
@ericzzzzzzz hi! Check it please, I think it'll be better to create patch release with these changes |
|
Hi, @idsulik thank you for the fix, but I think our best option may be just roll back all changes related to cache lookup to the previous good version v2.9.0, and revisit #9177 to see if the request is valid, we definitely need to document this about how skaffold cache works and what are the expected behaviors, I'll put a short summary about how we end up here from #9177 later, and create another issue to document skaffold caching |
|
@ericzzzzzzz I've double-checked these changes and I use it daily, it works perfectly, so I think it's safe to merge and use it |
|
I missed one case in the previous PR and fixed it here + added a test for it. I agree that we need some docs how the cache works because it was pretty hard to understand and keep in mind all the cases |
| cachedEntry.Digest = remoteDigest | ||
| c.cacheMutex.Lock() | ||
| c.artifactCache[hash] = cachedEntry | ||
| c.artifactCache[hash] = ImageDetails{Digest: remoteDigest} |
There was a problem hiding this comment.
I think skaffold saves digest to cache by checking the remote image after build, the code here might not be necessary and if this works as the code indicates it's confusing
- we find a remoteDigest with the target tag
- in cache miss case, we save the digest, skaffold will rebuild and re-push, then the digest changes on remote but the digest on the cache is old one??
There was a problem hiding this comment.
I've just checked it and found that we don't need to save the digest here because it'll be overwritten here pkg/skaffold/build/cache/details.go:121.
removed this part and pushed.
if you believe you've made some improvements on the good working version -- v2.9.0, please them on the description. Thanks I think there maybe some misunderstanding on the original issue,
|
in this PR works in this way |
thank you so much! I'll test it and give approve if everything works as expected. |
|
I don't know about v2.9.0, if it works the same, here we have separated methods for/local remote at least, so we can look at it as refactoring |
Fixes: #9248
Description
Hi! Within this PR #9278 I've fixed lookupRemote and it turned out that I've missed a case when the cache was missed but the image was found remotely (it'll be better to check the test case to understand it)
User facing changes (remove if N/A)
Before: when a tag wasn't found in the cache, but the image was found remotely by the tag, then we use needsRemoteTagging
After: with the same conditions it now uses needsBuilding instead