MCPcopy Create free account
hub / github.com/docker/cli / PutManifest

Method PutManifest

internal/registryclient/client.go:93–120  ·  view source on GitHub ↗

PutManifest sends the manifest to a registry and returns the new digest

(ctx context.Context, ref reference.Named, manifest distribution.Manifest)

Source from the content-addressed store, hash-verified

91
92// PutManifest sends the manifest to a registry and returns the new digest
93func (c *client) PutManifest(ctx context.Context, ref reference.Named, manifest distribution.Manifest) (digest.Digest, error) {
94 repoEndpoint, err := newDefaultRepositoryEndpoint(ref, c.insecureRegistry)
95 if err != nil {
96 return "", err
97 }
98
99 repoEndpoint.actions = []string{"pull", "push"}
100 repo, err := c.getRepositoryForReference(ctx, ref, repoEndpoint)
101 if err != nil {
102 return "", err
103 }
104
105 manifestService, err := repo.Manifests(ctx)
106 if err != nil {
107 return "", err
108 }
109
110 _, opts, err := getManifestOptionsFromReference(ref)
111 if err != nil {
112 return "", err
113 }
114
115 dgst, err := manifestService.Put(ctx, manifest, opts...)
116 if err != nil {
117 return dgst, fmt.Errorf("failed to put manifest %s: %w", ref, err)
118 }
119 return dgst, nil
120}
121
122func (c *client) getRepositoryForReference(ctx context.Context, ref reference.Named, repoEndpoint repositoryEndpoint) (distribution.Repository, error) {
123 repoName, err := reference.WithName(repoEndpoint.repoName)

Callers

nothing calls this directly

Tested by

no test coverage detected