Skip to content

Commit

Permalink
copy: avoid unnecessary re-encoding of source lists
Browse files Browse the repository at this point in the history
When copying a manifest list, if we don't change any of its contents and
don't change its type, use the original serialized version instead of
one that we re-encoded ourselves.

If we're writing to a digest reference, then this will avoid breakage
due to differences in whitespace.

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Apr 6, 2020
1 parent f0dd9a1 commit 5a69db8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions copy/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ func (c *copier) copyMultipleImages(ctx context.Context, policyContext *signatur
return nil, "", errors.Errorf("Error: manifest list must be converted to type %q to be written to destination, but that would invalidate signatures", thisListType)
}
logrus.Debugf("Manifest list has been updated")
} else {
// We can just use the original value, so use it instead of the one we just rebuilt, so that we don't change the digest.
attemptedManifestList = manifestList
}

// Save the manifest list.
Expand Down

0 comments on commit 5a69db8

Please sign in to comment.