Skip to content

Commit

Permalink
Split dockerImageDestination.uploadManifest from PutManifest
Browse files Browse the repository at this point in the history
We are going to need a way to upload to a tag without affecting
dockerImageDestination.manifestDigest.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
  • Loading branch information
mtrmac committed Jul 6, 2022
1 parent 61ca1c1 commit 1d80d3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docker/docker_image_dest.go
Expand Up @@ -439,7 +439,12 @@ func (d *dockerImageDestination) PutManifest(ctx context.Context, m []byte, inst
}
}

path := fmt.Sprintf(manifestPath, reference.Path(d.ref.ref), refTail)
return d.uploadManifest(ctx, m, refTail)
}

// uploadManifest writes manifest to tagOrDigest.
func (d *dockerImageDestination) uploadManifest(ctx context.Context, m []byte, tagOrDigest string) error {
path := fmt.Sprintf(manifestPath, reference.Path(d.ref.ref), tagOrDigest)

headers := map[string][]string{}
mimeType := manifest.GuessMIMEType(m)
Expand All @@ -453,7 +458,7 @@ func (d *dockerImageDestination) PutManifest(ctx context.Context, m []byte, inst
defer res.Body.Close()
if !successStatus(res.StatusCode) {
rawErr := registryHTTPResponseToError(res)
err := perrors.Wrapf(rawErr, "uploading manifest %s to %s", refTail, d.ref.ref.Name())
err := perrors.Wrapf(rawErr, "uploading manifest %s to %s", tagOrDigest, d.ref.ref.Name())
if isManifestInvalidError(rawErr) {
err = types.ManifestTypeRejectedError{Err: err}
}
Expand Down

0 comments on commit 1d80d3b

Please sign in to comment.