mirror of
https://github.com/containers/skopeo.git
synced 2025-06-28 15:47:34 +00:00
commit
a37421560d
@ -78,16 +78,12 @@ See skopeo-list-tags(1) section "REPOSITORY NAMES" for the expected format
|
|||||||
// Customized version of the alltransports.ParseImageName and docker.ParseReference that does not place a default tag in the reference
|
// Customized version of the alltransports.ParseImageName and docker.ParseReference that does not place a default tag in the reference
|
||||||
// Would really love to not have this, but needed to enforce tag-less and digest-less names
|
// Would really love to not have this, but needed to enforce tag-less and digest-less names
|
||||||
func parseDockerRepositoryReference(refString string) (types.ImageReference, error) {
|
func parseDockerRepositoryReference(refString string) (types.ImageReference, error) {
|
||||||
if !strings.HasPrefix(refString, docker.Transport.Name()+"://") {
|
dockerRefString, ok := strings.CutPrefix(refString, docker.Transport.Name()+"://")
|
||||||
|
if !ok {
|
||||||
return nil, fmt.Errorf("docker: image reference %s does not start with %s://", refString, docker.Transport.Name())
|
return nil, fmt.Errorf("docker: image reference %s does not start with %s://", refString, docker.Transport.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
_, dockerImageName, hasColon := strings.Cut(refString, ":")
|
ref, err := reference.ParseNormalizedNamed(dockerRefString)
|
||||||
if !hasColon {
|
|
||||||
return nil, fmt.Errorf(`Invalid image name "%s", expected colon-separated transport:reference`, refString)
|
|
||||||
}
|
|
||||||
|
|
||||||
ref, err := reference.ParseNormalizedNamed(strings.TrimPrefix(dockerImageName, "//"))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -1,7 +1,7 @@
|
|||||||
module github.com/containers/skopeo
|
module github.com/containers/skopeo
|
||||||
|
|
||||||
// Minimum required golang version
|
// Minimum required golang version
|
||||||
go 1.19 // ***** ATTENTION WARNING CAUTION DANGER ******
|
go 1.20 // ***** ATTENTION WARNING CAUTION DANGER ******
|
||||||
|
|
||||||
// Go versions 1.21 and later will AUTO-UPDATE based
|
// Go versions 1.21 and later will AUTO-UPDATE based
|
||||||
// on currently running tools and the (new) `toolchain`
|
// on currently running tools and the (new) `toolchain`
|
||||||
|
@ -139,7 +139,7 @@ located at [https://github.com/containers/image_build/tree/main/skopeo](https://
|
|||||||
|
|
||||||
Otherwise, read on for building and installing it from source:
|
Otherwise, read on for building and installing it from source:
|
||||||
|
|
||||||
To build the `skopeo` binary you need at least Go 1.19.
|
To build the `skopeo` binary you need at least Go 1.20.
|
||||||
|
|
||||||
There are two ways to build skopeo: in a container, or locally without a
|
There are two ways to build skopeo: in a container, or locally without a
|
||||||
container. Choose the one which better matches your needs and environment.
|
container. Choose the one which better matches your needs and environment.
|
||||||
|
@ -268,8 +268,8 @@ func decompressDir(t *testing.T, dir string) {
|
|||||||
rawLayer["size"] = uncompressedSize
|
rawLayer["size"] = uncompressedSize
|
||||||
var mimeType string
|
var mimeType string
|
||||||
getRawMapField(t, rawLayer, "mediaType", &mimeType)
|
getRawMapField(t, rawLayer, "mediaType", &mimeType)
|
||||||
if strings.HasSuffix(mimeType, ".gzip") { // This should use CutSuffix with Go ≥1.20
|
if uncompressedMIMEType, ok := strings.CutSuffix(mimeType, ".gzip"); ok {
|
||||||
rawLayer["mediaType"] = strings.TrimSuffix(mimeType, ".gzip")
|
rawLayer["mediaType"] = uncompressedMIMEType
|
||||||
}
|
}
|
||||||
|
|
||||||
rawLayers[i] = rawLayer
|
rawLayers[i] = rawLayer
|
||||||
|
Loading…
Reference in New Issue
Block a user