-
Notifications
You must be signed in to change notification settings - Fork 47
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
Change platform selection logic #189
Conversation
Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
This was previously fixed by PR 152, but that PR introduced another bug. Re-implement platform defaulting after the revert of PR 152. Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
596fa94
to
c0270c3
Compare
Benchmark Test ResultsBenchmark results from the latest changes vs base branch
|
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.
Initial nit comments added - I fully agree with the changes/reverts done to selectImageProvider
- I think this clears up the messaging and intent for users and puts it in a better spot than it is currently.
For discussion points:
-
I agree and think in hindsight making
registery
imitate the docker platform selection is the wrong call. Maybe we can settle on some good language to add to some part of the documentation expressing why they're different and the intention behind the two prefix -
I think this is fine as a single PR because there is some overlap between the two and it's not and overly complex revert/change =)
-
Oh no! I should have read this before I added my nit comment - This resonates with me and I'm good with the logic of if we're deciding a default then we commit and make a choice and never error. I'm fine with it being it's own function vs a method on the config just wanted to point out the other option since it's a mutation that doesn't return anything =)
Previously, the test would loop over the RepoDigest field in the image manifest to prove that the expect digest was present. However, in some cases, the RepoDigests field can be empty. Therefore, just use the ID from the manfiest, since this seems consisent across image sources, and is always present. Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
This reverts commit d7551b7. Defaulting to platform for all providers resulted in syft having unnecessary when pulling an image that had a particular digest, if that digest didn't match the architecture of the host running the pull. Revert commit d7551b7, which introduced that error, but then add platform defaulting logic back for the OCI Registry Provider, since defaulting there has been specifically requested. Add integ tests to cover the new behavior. Also, update integ tests to use the manifest ID for assertsion, since the RepoDigests array can be empty. Signed-off-by: Will Murphy <will.murphy@anchore.com>
This PR a couple things going on:
docker:
vsregistry:
from multi-platform images #149docker:
vsregistry:
from multi-platform images #149busybox:1.31
on thelinux/s390x
platform. Previously, tests only usedlinux/amd64
(which is an architecture match for many modern laptops) andlinux/arm64
(which is an architecture match for M1 macs). Addinglinux/s390x
images lets us pin down the behavior of image pulling that is almost certainly cross-platform. In other words, if we only havearm64
andamd64
test cases, then those test cases flip-flop between cross-platform and same-platform depending on whether the contributor is on an M1 or not, but adding some tests that use a platform found in fewer development laptops gives some tests that are always cross-platform.I wanted to point out a couple things for discussion:
docker:
vsregistry:
from multi-platform images #149 represented incorrect behavior. I could see an argument that making theregistry
provider imitate docker's platform selection was the wrong call.docker:
vsregistry:
from multi-platform images #149.defaultPlatformIfNil
intentionally swallows an error if it occurs. That's because we're trying to guess a default behavior here, and I don't think an attempt to infer the desired default should ever return an error.