Closed willmurphyscode closed 6 months ago
The new syft error handling (PR soon) will look like this:
❯ go run cmd/syft/main.go bitnamicharts/nginx:15.14.1
✔ Pulled image
✔ Parsed image sha256:fa265257e1b905d79242f2b25b506057d179a108831b99f27a2085fc02706fff
could not determine source: errors occurred attempting to resolve 'bitnamicharts/nginx:15.14.1':
- docker: unable to inspect existing image: Error response from daemon: No such image: bitnamicharts/nginx:15.14.1
- podman: podman not available: making http client: connection to bastion host="127.0.0.1:57447" failed: dial tcp 127.0.0.1:57447: connect: connection refused
- containerd: containerd not available: no grpc connection or services is available: unavailable
- oci-registry: unknown layer media type: application/vnd.cncf.helm.chart.content.v1.tar+gzip
- additionally, the following providers failed with file does not exist: docker-archive, oci-archive, oci-dir, singularity, oci-dir, local-file, local-directory
Because we don't know which provider the user was expecting to handle the source, report each error with the name of the provider that caused it, except for providers that fail with a file not found error - just report a list of those, since every provider that assumes the input string was a path on the local filesystem will fail with that error if it wasn't.
Reported in https://github.com/anchore/syft/issues/2745
TODO
IMO this is sort of confusing output. The last line "unknown layer media type: application/vnd.cncf.helm.chart.content.v1.tar+gzip" seems the most informative.
Basically, this is the error because stereoscope tried to use all its image providers to pull the image, and they all failed with various things, and Syft prints them all because it doesn't know which one is the "real" error. Probably more work is needed to translate this to a higher level error message in Syft. For example, the error has nothing to do with podman not being installed, but that's reported with the same UI prominence as the unsupported media type error.