diff --git a/common/go.mod b/common/go.mod index 82677cdf71..578372a160 100644 --- a/common/go.mod +++ b/common/go.mod @@ -95,7 +95,7 @@ require ( github.com/mistifyio/go-zfs/v4 v4.0.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/moby/api v1.55.0 // indirect - github.com/moby/moby/client v0.4.1 // indirect + github.com/moby/moby/client v0.5.0 // indirect github.com/moby/sys/mountinfo v0.7.2 // indirect github.com/moby/sys/user v0.4.0 // indirect github.com/moby/sys/userns v0.1.0 // indirect diff --git a/common/go.sum b/common/go.sum index 60883cd9f3..d412650d3b 100644 --- a/common/go.sum +++ b/common/go.sum @@ -153,8 +153,8 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/moby/api v1.55.0 h1:2/sexvQyqIWS8pRSCFddBfpW2qE7vR7FCL+vN8pxwMc= github.com/moby/moby/api v1.55.0/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= -github.com/moby/moby/client v0.4.1 h1:DMQgisVoMkmMs7fp3ROSdiBnoAu8+vo3GggFl06M/wY= -github.com/moby/moby/client v0.4.1/go.mod h1:z52C9O2POPOsnxZAy//WtKcQ32P+jT/NGeXu/7nfjGQ= +github.com/moby/moby/client v0.5.0 h1:5XhyPk2fuOWf6RlSFa3MkIIgDZkF25xToXW8Q/BH7cc= +github.com/moby/moby/client v0.5.0/go.mod h1:rcVpF8ncl9vo5gaIBdol6CnbEtSj1uxMvEV/UrykF/s= github.com/moby/sys/capability v0.4.0 h1:4D4mI6KlNtWMCM1Z/K0i7RV1FkX+DBDHKVJpCndZoHk= github.com/moby/sys/capability v0.4.0/go.mod h1:4g9IK291rVkms3LKCDOoYlnV8xKwoDTpIrNEE35Wq0I= github.com/moby/sys/devices v0.1.0 h1:uaMrDm1U3h0AwUDNWeT5lBV40v0eayt+VuukRbYn5K4= diff --git a/image/go.mod b/image/go.mod index 0e20f01679..33626422cc 100644 --- a/image/go.mod +++ b/image/go.mod @@ -23,7 +23,7 @@ require ( github.com/manifoldco/promptui v0.9.0 github.com/mattn/go-sqlite3 v1.14.47 github.com/moby/moby/api v1.55.0 - github.com/moby/moby/client v0.4.1 + github.com/moby/moby/client v0.5.0 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.1 github.com/proglottis/gpgme v0.1.6 diff --git a/image/go.sum b/image/go.sum index 7d9775ff52..5e9eced361 100644 --- a/image/go.sum +++ b/image/go.sum @@ -122,8 +122,8 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/moby/api v1.55.0 h1:2/sexvQyqIWS8pRSCFddBfpW2qE7vR7FCL+vN8pxwMc= github.com/moby/moby/api v1.55.0/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= -github.com/moby/moby/client v0.4.1 h1:DMQgisVoMkmMs7fp3ROSdiBnoAu8+vo3GggFl06M/wY= -github.com/moby/moby/client v0.4.1/go.mod h1:z52C9O2POPOsnxZAy//WtKcQ32P+jT/NGeXu/7nfjGQ= +github.com/moby/moby/client v0.5.0 h1:5XhyPk2fuOWf6RlSFa3MkIIgDZkF25xToXW8Q/BH7cc= +github.com/moby/moby/client v0.5.0/go.mod h1:rcVpF8ncl9vo5gaIBdol6CnbEtSj1uxMvEV/UrykF/s= github.com/moby/sys/capability v0.4.0 h1:4D4mI6KlNtWMCM1Z/K0i7RV1FkX+DBDHKVJpCndZoHk= github.com/moby/sys/capability v0.4.0/go.mod h1:4g9IK291rVkms3LKCDOoYlnV8xKwoDTpIrNEE35Wq0I= github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg= diff --git a/vendor/github.com/moby/moby/client/client.go b/vendor/github.com/moby/moby/client/client.go index 89ba88ee5c..4b4ef976a3 100644 --- a/vendor/github.com/moby/moby/client/client.go +++ b/vendor/github.com/moby/moby/client/client.go @@ -109,7 +109,7 @@ const DummyHost = "api.moby.localhost" // overriding the version and disable API-version negotiation. // // This version may be lower than the version of the api library module used. -const MaxAPIVersion = "1.54" +const MaxAPIVersion = "1.55" // MinAPIVersion is the minimum API version supported by the client. API versions // below this version are not considered when performing API-version negotiation. diff --git a/vendor/github.com/moby/moby/client/client_interfaces.go b/vendor/github.com/moby/moby/client/client_interfaces.go index 4bbd45a6e5..fd1b9dac39 100644 --- a/vendor/github.com/moby/moby/client/client_interfaces.go +++ b/vendor/github.com/moby/moby/client/client_interfaces.go @@ -133,6 +133,7 @@ type ImageAPIClient interface { ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (ImageInspectResult, error) ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) (ImageHistoryResult, error) + ImageAttestations(ctx context.Context, image string, _ ...ImageAttestationsOption) (ImageAttestationsResult, error) ImageLoad(ctx context.Context, input io.Reader, _ ...ImageLoadOption) (ImageLoadResult, error) ImageSave(ctx context.Context, images []string, _ ...ImageSaveOption) (ImageSaveResult, error) diff --git a/vendor/github.com/moby/moby/client/image_attestations.go b/vendor/github.com/moby/moby/client/image_attestations.go new file mode 100644 index 0000000000..c02d975197 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_attestations.go @@ -0,0 +1,51 @@ +package client + +import ( + "context" + "encoding/json" + "net/url" +) + +// ImageAttestations returns the in-toto attestation statements attached to an +// image for the given platform. This requires API version 1.55 or higher. +func (cli *Client) ImageAttestations(ctx context.Context, imageID string, opts ...ImageAttestationsOption) (ImageAttestationsResult, error) { + if imageID == "" { + return ImageAttestationsResult{}, objectNotFoundError{object: "image", id: imageID} + } + + if err := cli.requiresVersion(ctx, "1.55", "attestations"); err != nil { + return ImageAttestationsResult{}, err + } + + var o imageAttestationsOpts + for _, opt := range opts { + if err := opt.Apply(&o); err != nil { + return ImageAttestationsResult{}, err + } + } + + query := url.Values{} + if o.platform != nil { + p, err := encodePlatform(o.platform) + if err != nil { + return ImageAttestationsResult{}, err + } + query.Set("platform", p) + } + for _, pt := range o.predicateTypes { + query.Add("type", pt) + } + if o.includeStatement { + query.Set("statement", "1") + } + + resp, err := cli.get(ctx, "/images/"+imageID+"/attestations", query, nil) + defer ensureReaderClosed(resp) + if err != nil { + return ImageAttestationsResult{}, err + } + + var result ImageAttestationsResult + err = json.NewDecoder(resp.Body).Decode(&result.Items) + return result, err +} diff --git a/vendor/github.com/moby/moby/client/image_attestations_opts.go b/vendor/github.com/moby/moby/client/image_attestations_opts.go new file mode 100644 index 0000000000..4a7c3bcf84 --- /dev/null +++ b/vendor/github.com/moby/moby/client/image_attestations_opts.go @@ -0,0 +1,56 @@ +package client + +import ( + "github.com/moby/moby/api/types/image" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +// ImageAttestationsResult is the result of an ImageAttestations operation. +type ImageAttestationsResult struct { + Items []image.AttestationStatement +} + +// ImageAttestationsOption is a functional option for the ImageAttestations operation. +type ImageAttestationsOption interface { + Apply(*imageAttestationsOpts) error +} + +type imageAttestationsOptionFunc func(*imageAttestationsOpts) error + +func (f imageAttestationsOptionFunc) Apply(o *imageAttestationsOpts) error { return f(o) } + +type imageAttestationsOpts struct { + platform *ocispec.Platform + predicateTypes []string + includeStatement bool +} + +// ImageAttestationsWithPlatform filters attestations to those for the given +// platform variant. If omitted, the daemon's default platform is used. +func ImageAttestationsWithPlatform(platform ocispec.Platform) ImageAttestationsOption { + return imageAttestationsOptionFunc(func(o *imageAttestationsOpts) error { + o.platform = &platform + return nil + }) +} + +// ImageAttestationsWithPredicateTypes filters returned statements to those +// whose in-toto predicate type matches one of the given URIs. +// If not set, all statements are returned. +func ImageAttestationsWithPredicateTypes(types ...string) ImageAttestationsOption { + return imageAttestationsOptionFunc(func(o *imageAttestationsOpts) error { + o.predicateTypes = append(o.predicateTypes, types...) + return nil + }) +} + +// ImageAttestationsWithStatement asks the daemon to include the verbatim +// in-toto statement body in each returned entry. Without this option, only +// the descriptor and predicate type are returned and statement blobs are +// not read. +func ImageAttestationsWithStatement() ImageAttestationsOption { + return imageAttestationsOptionFunc(func(o *imageAttestationsOpts) error { + o.includeStatement = true + return nil + }) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index f6ac8fbb3e..1fc4aa06ee 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -271,7 +271,7 @@ github.com/moby/moby/api/types/storage github.com/moby/moby/api/types/swarm github.com/moby/moby/api/types/system github.com/moby/moby/api/types/volume -# github.com/moby/moby/client v0.4.1 +# github.com/moby/moby/client v0.5.0 ## explicit; go 1.24 github.com/moby/moby/client github.com/moby/moby/client/internal