diff --git a/api/types/types.go b/api/types/types.go index 8457ca0411..c74cec0b29 100644 --- a/api/types/types.go +++ b/api/types/types.go @@ -43,12 +43,3 @@ type Version struct { Experimental bool `json:",omitempty"` BuildTime string `json:",omitempty"` } - -// PushResult contains the tag, manifest digest, and manifest size from the -// push. It's used to signal this information to the trust code in the client -// so it can sign the manifest if necessary. -type PushResult struct { - Tag string - Digest string - Size int -} diff --git a/daemon/internal/distribution/push_v2.go b/daemon/internal/distribution/push_v2.go index e432cf6bff..4465b9175f 100644 --- a/daemon/internal/distribution/push_v2.go +++ b/daemon/internal/distribution/push_v2.go @@ -14,7 +14,6 @@ import ( "github.com/docker/distribution/manifest/schema2" "github.com/docker/distribution/registry/api/errcode" "github.com/docker/distribution/registry/client" - apitypes "github.com/moby/moby/api/types" "github.com/moby/moby/v2/daemon/internal/distribution/metadata" "github.com/moby/moby/v2/daemon/internal/distribution/xfer" "github.com/moby/moby/v2/daemon/internal/layer" @@ -211,9 +210,20 @@ func (p *pusher) pushTag(ctx context.Context, ref reference.NamedTagged, id dige return err } + // pushResult contains the tag, manifest digest, and manifest size from the + // push. It's used to signal this information to the trust code in the client + // so it can sign the manifest if necessary. + // + // TODO(thaJeztah): this aux-type is only present for docker content trust, which is deprecated. + type pushResult struct { + Tag string + Digest string + Size int + } + // Signal digest to the trust client so it can sign the // push, if appropriate. - progress.Aux(p.config.ProgressOutput, apitypes.PushResult{Tag: ref.Tag(), Digest: manifestDigest.String(), Size: len(canonicalManifest)}) + progress.Aux(p.config.ProgressOutput, pushResult{Tag: ref.Tag(), Digest: manifestDigest.String(), Size: len(canonicalManifest)}) return nil } diff --git a/daemon/pkg/plugin/backend_linux.go b/daemon/pkg/plugin/backend_linux.go index 6470ab5e4f..6fc2325c1f 100644 --- a/daemon/pkg/plugin/backend_linux.go +++ b/daemon/pkg/plugin/backend_linux.go @@ -22,7 +22,6 @@ import ( "github.com/containerd/platforms" "github.com/distribution/reference" "github.com/moby/go-archive/chrootarchive" - "github.com/moby/moby/api/types" "github.com/moby/moby/api/types/events" "github.com/moby/moby/api/types/plugin" "github.com/moby/moby/api/types/registry" @@ -464,8 +463,19 @@ func (pm *Manager) Push(ctx context.Context, name string, metaHeader http.Header progress.Update(out, pj.names[j], "Upload complete") } + // pushResult contains the tag, manifest digest, and manifest size from the + // push. It's used to signal this information to the trust code in the client + // so it can sign the manifest if necessary. + // + // TODO(thaJeztah): this aux-type is only present for docker content trust, which is deprecated. + type pushResult struct { + Tag string + Digest string + Size int + } + // Signal the client for content trust verification - progress.Aux(out, types.PushResult{Tag: ref.(reference.Tagged).Tag(), Digest: desc.Digest.String(), Size: int(desc.Size)}) + progress.Aux(out, pushResult{Tag: ref.(reference.Tagged).Tag(), Digest: desc.Digest.String(), Size: int(desc.Size)}) return nil } diff --git a/integration/plugin/common/plugin_test.go b/integration/plugin/common/plugin_test.go index edc2d20157..e0d981288e 100644 --- a/integration/plugin/common/plugin_test.go +++ b/integration/plugin/common/plugin_test.go @@ -15,7 +15,6 @@ import ( c8dimages "github.com/containerd/containerd/v2/core/images" "github.com/containerd/containerd/v2/core/remotes/docker" - "github.com/moby/moby/api/types" "github.com/moby/moby/api/types/jsonstream" registrytypes "github.com/moby/moby/api/types/registry" "github.com/moby/moby/api/types/system" @@ -136,16 +135,27 @@ func TestPluginInstall(t *testing.T) { err := plugin.Create(ctx, apiclient, repo) assert.NilError(t, err) - pushResult, err := apiclient.PluginPush(ctx, repo, client.PluginPushOptions{}) + res, err := apiclient.PluginPush(ctx, repo, client.PluginPushOptions{}) assert.NilError(t, err) - defer pushResult.Close() + defer res.Close() buf := &strings.Builder{} assert.NilError(t, err) var digest string - assert.NilError(t, jsonmessage.DisplayJSONMessagesStream(pushResult, buf, 0, false, func(j jsonstream.Message) { + + // PushResult contains the tag, manifest digest, and manifest size from the + // push. It's used to signal this information to the trust code in the client + // so it can sign the manifest if necessary. + // + // TODO(thaJeztah): this aux-type is only present for docker content trust, which is deprecated. + type pushResult struct { + Tag string + Digest string + Size int + } + assert.NilError(t, jsonmessage.DisplayJSONMessagesStream(res, buf, 0, false, func(j jsonstream.Message) { if j.Aux != nil { - var r types.PushResult + var r pushResult assert.NilError(t, json.Unmarshal(*j.Aux, &r)) digest = r.Digest } diff --git a/vendor/github.com/moby/moby/api/types/types.go b/vendor/github.com/moby/moby/api/types/types.go index 8457ca0411..c74cec0b29 100644 --- a/vendor/github.com/moby/moby/api/types/types.go +++ b/vendor/github.com/moby/moby/api/types/types.go @@ -43,12 +43,3 @@ type Version struct { Experimental bool `json:",omitempty"` BuildTime string `json:",omitempty"` } - -// PushResult contains the tag, manifest digest, and manifest size from the -// push. It's used to signal this information to the trust code in the client -// so it can sign the manifest if necessary. -type PushResult struct { - Tag string - Digest string - Size int -}