diff --git a/go.mod b/go.mod index 74cb98b712..33184c28ad 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/containers/storage v1.51.0 github.com/docker/distribution v2.8.3+incompatible github.com/opencontainers/go-digest v1.0.0 - github.com/opencontainers/image-spec v1.1.0-rc5 + github.com/opencontainers/image-spec v1.1.0-rc6 github.com/opencontainers/image-tools v1.0.0-rc3 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 26b666b099..1d27414a99 100644 --- a/go.sum +++ b/go.sum @@ -274,8 +274,8 @@ github.com/onsi/ginkgo/v2 v2.13.1 h1:LNGfMbR2OVGBfXjvRZIZ2YCTQdGKtPLvuI1rMCCj3OU github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= -github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= +github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/image-tools v1.0.0-rc3 h1:ZR837lBIxq6mmwEqfYrbLMuf75eBSHhccVHy6lsBeM4= github.com/opencontainers/image-tools v1.0.0-rc3/go.mod h1:A9btVpZLzttF4iFaKNychhPyrhfOjJ1OF5KrA8GcLj4= github.com/opencontainers/runc v1.1.10 h1:EaL5WeO9lv9wmS6SASjszOeQdSctvpbu0DdBQBizE40= diff --git a/vendor/github.com/opencontainers/image-spec/schema/error.go b/vendor/github.com/opencontainers/image-spec/schema/error.go index baf8751958..c667c23e26 100644 --- a/vendor/github.com/opencontainers/image-spec/schema/error.go +++ b/vendor/github.com/opencontainers/image-spec/schema/error.go @@ -17,6 +17,7 @@ package schema import ( "bufio" "encoding/json" + "errors" "io" ) @@ -34,7 +35,8 @@ func (e *SyntaxError) Error() string { return e.msg } // and converts it into a *schema.SyntaxError containing line/col information using the given reader. // If the given error is not a *json.SyntaxError it is returned unchanged. func WrapSyntaxError(r io.Reader, err error) error { - if serr, ok := err.(*json.SyntaxError); ok { + var serr *json.SyntaxError + if errors.As(err, &serr) { buf := bufio.NewReader(r) line := 0 col := 0 diff --git a/vendor/github.com/opencontainers/image-spec/schema/validator.go b/vendor/github.com/opencontainers/image-spec/schema/validator.go index 4b8cd0869e..b7a0acaa81 100644 --- a/vendor/github.com/opencontainers/image-spec/schema/validator.go +++ b/vendor/github.com/opencontainers/image-spec/schema/validator.go @@ -17,13 +17,13 @@ package schema import ( "bytes" "encoding/json" + "errors" "fmt" "io" "regexp" digest "github.com/opencontainers/go-digest" v1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/pkg/errors" "github.com/xeipuuv/gojsonschema" ) @@ -53,7 +53,7 @@ func (e ValidationError) Error() string { func (v Validator) Validate(src io.Reader) error { buf, err := io.ReadAll(src) if err != nil { - return errors.Wrap(err, "unable to read the document file") + return fmt.Errorf("unable to read the document file: %w", err) } if f, ok := mapValidate[v]; ok { @@ -71,9 +71,8 @@ func (v Validator) Validate(src io.Reader) error { result, err := gojsonschema.Validate(sl, ml) if err != nil { - return errors.Wrapf( - WrapSyntaxError(bytes.NewReader(buf), err), - "schema %s: unable to validate", v) + return fmt.Errorf("schema %s: unable to validate: %w", v, + WrapSyntaxError(bytes.NewReader(buf), err)) } if result.Valid() { @@ -101,12 +100,12 @@ func validateManifest(r io.Reader) error { buf, err := io.ReadAll(r) if err != nil { - return errors.Wrapf(err, "error reading the io stream") + return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { - return errors.Wrap(err, "manifest format mismatch") + return fmt.Errorf("manifest format mismatch: %w", err) } if header.Config.MediaType != string(v1.MediaTypeImageConfig) { @@ -131,16 +130,16 @@ func validateDescriptor(r io.Reader) error { buf, err := io.ReadAll(r) if err != nil { - return errors.Wrapf(err, "error reading the io stream") + return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { - return errors.Wrap(err, "descriptor format mismatch") + return fmt.Errorf("descriptor format mismatch: %w", err) } err = header.Digest.Validate() - if err == digest.ErrDigestUnsupported { + if errors.Is(err, digest.ErrDigestUnsupported) { // we ignore unsupported algorithms fmt.Printf("warning: unsupported digest: %q: %v\n", header.Digest, err) return nil @@ -153,12 +152,12 @@ func validateIndex(r io.Reader) error { buf, err := io.ReadAll(r) if err != nil { - return errors.Wrapf(err, "error reading the io stream") + return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { - return errors.Wrap(err, "index format mismatch") + return fmt.Errorf("index format mismatch: %w", err) } for _, manifest := range header.Manifests { @@ -180,12 +179,12 @@ func validateConfig(r io.Reader) error { buf, err := io.ReadAll(r) if err != nil { - return errors.Wrapf(err, "error reading the io stream") + return fmt.Errorf("error reading the io stream: %w", err) } err = json.Unmarshal(buf, &header) if err != nil { - return errors.Wrap(err, "config format mismatch") + return fmt.Errorf("config format mismatch: %w", err) } checkPlatform(header.OS, header.Architecture) @@ -194,7 +193,7 @@ func validateConfig(r io.Reader) error { envRegexp := regexp.MustCompile(`^[^=]+=.*$`) for _, e := range header.Config.Env { if !envRegexp.MatchString(e) { - return errors.Errorf("unexpected env: %q", e) + return fmt.Errorf("unexpected env: %q", e) } } diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go index 892ba3de9d..ce8313e796 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/mediatype.go @@ -21,12 +21,20 @@ const ( // MediaTypeLayoutHeader specifies the media type for the oci-layout. MediaTypeLayoutHeader = "application/vnd.oci.layout.header.v1+json" + // MediaTypeImageIndex specifies the media type for an image index. + MediaTypeImageIndex = "application/vnd.oci.image.index.v1+json" + // MediaTypeImageManifest specifies the media type for an image manifest. MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json" - // MediaTypeImageIndex specifies the media type for an image index. - MediaTypeImageIndex = "application/vnd.oci.image.index.v1+json" + // MediaTypeImageConfig specifies the media type for the image configuration. + MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json" + + // MediaTypeEmptyJSON specifies the media type for an unused blob containing the value "{}". + MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json" +) +const ( // MediaTypeImageLayer is the media type used for layers referenced by the manifest. MediaTypeImageLayer = "application/vnd.oci.image.layer.v1.tar" @@ -37,7 +45,15 @@ const ( // MediaTypeImageLayerZstd is the media type used for zstd compressed // layers referenced by the manifest. MediaTypeImageLayerZstd = "application/vnd.oci.image.layer.v1.tar+zstd" +) +// Non-distributable layer media-types. +// +// Deprecated: Non-distributable layers are deprecated, and not recommended +// for future use. Implementations SHOULD NOT produce new non-distributable +// layers. +// https://github.com/opencontainers/image-spec/pull/965 +const ( // MediaTypeImageLayerNonDistributable is the media type for layers referenced by // the manifest but with distribution restrictions. // @@ -66,10 +82,4 @@ const ( // layers. // https://github.com/opencontainers/image-spec/pull/965 MediaTypeImageLayerNonDistributableZstd = "application/vnd.oci.image.layer.nondistributable.v1.tar+zstd" - - // MediaTypeImageConfig specifies the media type for the image configuration. - MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json" - - // MediaTypeEmptyJSON specifies the media type for an unused blob containing the value `{}` - MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json" ) diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/version.go b/vendor/github.com/opencontainers/image-spec/specs-go/version.go index 11e09b5846..6d01f6e717 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/version.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/version.go @@ -25,7 +25,7 @@ const ( VersionPatch = 0 // VersionDev indicates development branch. Releases will be empty string. - VersionDev = "-rc.5" + VersionDev = "-rc.6" ) // Version is the specification version that the package types support. diff --git a/vendor/modules.txt b/vendor/modules.txt index 240f5d76ba..de61e28780 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -431,7 +431,7 @@ github.com/oklog/ulid ## explicit; go 1.13 github.com/opencontainers/go-digest github.com/opencontainers/go-digest/digestset -# github.com/opencontainers/image-spec v1.1.0-rc5 +# github.com/opencontainers/image-spec v1.1.0-rc6 ## explicit; go 1.18 github.com/opencontainers/image-spec/schema github.com/opencontainers/image-spec/specs-go