Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Check for existence of layers in cache before returning cached base image #3767
Check for existence of layers in cache before returning cached base image #3767
Changes from all commits
3caa0ab
c1d1d4d
ecb4575
0d70c29
c9a51ec
755dcfc
b231d79
6ee16e0
ac8a2c7
cd2070f
7e89ea7
3445f77
1456e95
099c0ce
ab53ec2
05097fb
d891281
4971ee9
4ecb92f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 wonder if this would break current behavior for those doing multi-platform image building? For context #2730, we also do caching for manifest lists in addition to single manifests.
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.
That’s a good callout, and please let me know if I'm misunderstanding anything here!
Right now the added logic in
PullBaseImageStep.getCachedBaseImages()
never passes anything ofV22ManifestList
type intoareAllLayersCached()
calls explicitly. In the case of manifest lists, this check is made individually when looping over the platform-specific manifests, and returns an overall cache miss if any of the platform-specific manifests has incomplete layers.But, do you think there is value here to have
CacheStorageReader.areAllLayersCached()
itself handle the manifest list type, rather than rely on the code calling it? Perhaps instead of throwing an exception here, it can also just return false, and leave the rest of the behavior to existing logic?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.
Ah thanks for the detailed explanation! You're right, it is called for the individual manifests in the manifest list.
Hm that's a good question. I was initially thinking about this too but looking at the code for
getCachedBaseImage
, we would probably still have to iterate through the manifests in the manifest list again to retrieve the collection of images? What you have currently (which a more fail-fast approach) seems like a better choice.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.
Sounds good!
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.
Minor suggestion: If possible, let's format the test into three blocks: arrange, act and assert, with a space between each of these blocks. The
arrange
block will take care of all setup, theact
block will call the method we're testing and theassert
block will do all the verification.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 for the suggestion, this makes a lot of sense! Tried to follow this idea though with the
act
andassert
block more or less combined, since for a few of the tests had asserts both before and after certain actions.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.
How about we store these calls in variables? For example:
This is just an example so you can pick a name you think works better.
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.
Ohh apologies I completely misunderstood earlier! Thank you for the explanation, I see what is meant by having separate
act
andassert
blocks now. Will update the tests 😃