in pkg/registry/artifact.go [27:54]
func ParseArtifactFromURI(uri string) (*Artifact, error) {
elements := strings.SplitN(uri, "/", 2)
if len(elements) != 2 {
return nil, fmt.Errorf("registry not found")
}
registry := elements[0]
rol := elements[1]
var tag string
var digest string
elements = strings.SplitN(rol, "@", 2)
if len(elements) != 2 {
elements = strings.SplitN(rol, ":", 2)
if len(elements) != 2 {
return nil, fmt.Errorf("tag or digest not found")
}
tag = elements[1]
} else {
digest = elements[1]
}
repository := elements[0]
return &Artifact{
Registry: registry,
Repository: repository,
Tag: tag,
Digest: digest,
}, nil
}