buildpacks / imgutil

Helpful utilities for working with images
Apache License 2.0
24 stars 41 forks source link

Expose a method to parse an image reference into a local path #168

Closed jjbustamante closed 1 year ago

jjbustamante commented 1 year ago

Reason

As part of the implementation of the export to OCI Layout feature we required to translate an image reference and map it to a path in the local filesystem. This operation is useful for Lifecycle implementors but also for Platform implementors, that's why the best place to offer this utility method is on imgUtil repository.

Expected behavior

Considering an image reference refers to either a tag reference or digest reference. It has the following formats

Expose a method like:

classDiagram

class layout {
    ParseRefToPath(imageRef string) (string, error)
}

This method parses the given image reference to local path directory following the rules:

Related

See issue 152 for more context