Skip to content
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

DRAFT: Improve architecture selection #187

Closed
wants to merge 4 commits into from

Conversation

willmurphyscode
Copy link
Contributor

This is a draft PR to track improving architecture selection in stereoscope.

Basically, when a user of syft or grype specifies a digest, we should not validate the platform, since a digest is an unambiguous reference, but we fail on the platofrm. For example:

❯ grype mcr.microsoft.com/cbl-mariner/base/core:2.0.20220731-amd64@sha256:3c0f7e103ff3c39e81e7c9c042d2b321d833fb6d26d8636567f7d88a6bdde74a
 ✔ Vulnerability DB        [no update available]
 ⠹ Pulling image           2 Layers▕ █▏[28 MB] Extracting...
1 error occurred:
	* failed to catalog: could not fetch image "mcr.microsoft.com/cbl-mariner/base/core:2.0.20220731-amd64@sha256:3c0f7e103ff3c39e81e7c9c042d2b321d833fb6d26d8636567f7d88a6bdde74a": unable to use DockerDaemon source: image has unexpected architecture "amd64", which differs from the user specified architecture "arm64"

This was probably introduced by #152 in fixing #149.

The goal of this change is to preserve the fix to #149 but remove the issue, seen via grype above, where unambiguous requests fail at

return fmt.Errorf("image has unexpected architecture %q, which differs from the user specified architecture %q", i.Architecture, p.platform.Architecture)
even when the user didn't pass --platform.

It's a draft pull request for now because I need to make test images at https://github.com/anchore/test-images to exercise the different scenarios in stereoscope integration tests before it can be merged.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
@github-actions
Copy link

Benchmark Test Results

Benchmark results from the latest changes vs base branch
latest: Pulling from library/ubuntu
dbf6a9befcde: Pull complete
tar: Option --mtime: Treating date 'UTC 2019-09-16' as 2019-09-16 00:00:00
goos: linux
goarch: amd64
pkg: github.com/anchore/stereoscope/pkg/file
cpu: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
docker: 
           │ ./.tmp/benchmark-2315cea.txt │
           │            sec/op            │
TarIndex-2                   42.52µ ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95

           │ ./.tmp/benchmark-2315cea.txt │
           │             B/op             │
TarIndex-2                  5.560Ki ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95

           │ ./.tmp/benchmark-2315cea.txt │
           │          allocs/op           │
TarIndex-2                    93.00 ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95

pkg: github.com/anchore/stereoscope/test/integration
                                      │ ./.tmp/benchmark-2315cea.txt │
                                      │            sec/op            │
SimpleImage_GetImage/docker-archive-2                   1.553m ± ∞ ¹
SimpleImage_GetImage/oci-archive-2                      1.297m ± ∞ ¹
SimpleImage_GetImage/oci-dir-2                          805.5µ ± ∞ ¹
geomean                                                 1.175m
¹ need >= 6 samples for confidence interval at level 0.95

                                      │ ./.tmp/benchmark-2315cea.txt │
                                      │             B/op             │
SimpleImage_GetImage/docker-archive-2                  363.6Ki ± ∞ ¹
SimpleImage_GetImage/oci-archive-2                     646.1Ki ± ∞ ¹
SimpleImage_GetImage/oci-dir-2                         413.4Ki ± ∞ ¹
geomean                                                459.7Ki
¹ need >= 6 samples for confidence interval at level 0.95

                                      │ ./.tmp/benchmark-2315cea.txt │
                                      │          allocs/op           │
SimpleImage_GetImage/docker-archive-2                   2.842k ± ∞ ¹
SimpleImage_GetImage/oci-archive-2                      1.564k ± ∞ ¹
SimpleImage_GetImage/oci-dir-2                          1.348k ± ∞ ¹
geomean                                                 1.816k
¹ need >= 6 samples for confidence interval at level 0.95

docker: Error response from daemon: Get "http://localhost/v2/": dial tcp [::1]:80: connect: connection refused.
                                                   │ ./.tmp/benchmark-2315cea.txt │
                                                   │            sec/op            │
SimpleImage_FetchSquashedContents/docker-archive-2                   17.46µ ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95

                                                   │ ./.tmp/benchmark-2315cea.txt │
                                                   │             B/op             │
SimpleImage_FetchSquashedContents/docker-archive-2                  2.648Ki ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95

                                                   │ ./.tmp/benchmark-2315cea.txt │
                                                   │          allocs/op           │
SimpleImage_FetchSquashedContents/docker-archive-2                    21.00 ± ∞ ¹
¹ need >= 6 samples for confidence interval at level 0.95

@wagoodman
Copy link
Contributor

@willmurphyscode is this PR still needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants