Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wagoodman
Copy link
Contributor

@wagoodman wagoodman commented Sep 23, 2020

Today we allow for the following user input strings:

docker://alpine:latest
docker://anchore/anchore-engine
ubuntu:latest
docker-archive://some/path/to.tar
tar://some/path/to.tar
tarball://some/path/to.tar
oci-directory://some/path/to/dir
oci-archive://some/path/to.tar
oci-tar://some/path/to.tar

This PR aims to bring us closer to the URI specifications (RFC2396 and RFC3986) by eliminating the URL-specific authority indicator (//) from the string requests and use purely a scheme approach:

docker:alpine:latest
docker:anchore/anchore-engine
ubuntu:latest
docker-archive:some/path/to.tar
oci-archive:some/path/to.tar

# new: automatically detect the image... this will automatically resolve to either oci-directory, oci-archive, or docker-archive
./just/some/path

We also want to remove redundant options:

  • tar
  • tarball
  • oci-directory
  • oci
  • docker-tar

This is to minimize the risk of a scheme overlap with user input.

Lastly, we came to a conclusion from offline discussions that we should migrate image fixture utils from the go-testutils repo to here, as currently there is a cyclic package dependency problem which complicates updating the feature set as a whole. These utils have been moved to pkg/imagetest (this was a good PR to do so since a change to the utility functions was required for the above scheme changes).

Partially addresses: anchore/syft#177 and anchore/grype#157

@wagoodman wagoodman self-assigned this Sep 24, 2020
@wagoodman
Copy link
Contributor Author

wagoodman commented Sep 24, 2020

@luhring @alfredodeza

Looking closer at the docker: scheme, it may make sense to leave this with an authority component, since it may imply that the image reference is relative to the docker daemon to interpret the remaining path. The same would be true for podman when that support is added.

That is, I think leaving docker:// as is since we are querying the [central] docker daemon and it is interpreting the path elements --the docker daemon is acting as the authority. This also clears up some edge cases outlined in the tests (e.g. docker:latest vs docker:docker:latest).

This especially makes sense for digests and IDs --these are valid inputs only relative to the local Docker daemon.

The rest of the changes would remain the same (docker-archive, oci-directory, etc).

Signed-off-by: Alex Goodman <[email protected]>
@wagoodman
Copy link
Contributor Author

After some discussion internally, we're sticking to purely URI schemes (no authority will be assumed/needed)

@wagoodman wagoodman merged commit d086a34 into main Sep 25, 2020
@wagoodman wagoodman deleted the use-uri-scheme branch September 25, 2020 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants