image/save: Change layers type to DiffID
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 4979605212
)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
615dfdf672
commit
4d287e9267
1 changed files with 6 additions and 5 deletions
|
@ -29,7 +29,7 @@ import (
|
|||
|
||||
type imageDescriptor struct {
|
||||
refs []reference.NamedTagged
|
||||
layers []digest.Digest
|
||||
layers []layer.DiffID
|
||||
image *image.Image
|
||||
layerRef layer.Layer
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ func (s *saveSession) save(outStream io.Writer) error {
|
|||
if _, ok := reposLegacy[familiarName]; !ok {
|
||||
reposLegacy[familiarName] = make(map[string]string)
|
||||
}
|
||||
reposLegacy[familiarName][ref.Tag()] = imageDescr.layers[len(imageDescr.layers)-1].Encoded()
|
||||
reposLegacy[familiarName][ref.Tag()] = digest.Digest(imageDescr.layers[len(imageDescr.layers)-1]).Encoded()
|
||||
repoTags = append(repoTags, reference.FamiliarString(ref))
|
||||
|
||||
manifestDescriptors = append(manifestDescriptors, ocispec.Descriptor{
|
||||
|
@ -281,7 +281,8 @@ func (s *saveSession) save(outStream io.Writer) error {
|
|||
for _, l := range imageDescr.layers {
|
||||
// IMPORTANT: We use path, not filepath here to ensure the layers
|
||||
// in the manifest use Unix-style forward-slashes.
|
||||
layers = append(layers, path.Join(ocispec.ImageBlobsDir, l.Algorithm().String(), l.Encoded()))
|
||||
lDgst := digest.Digest(l)
|
||||
layers = append(layers, path.Join(ocispec.ImageBlobsDir, lDgst.Algorithm().String(), lDgst.Encoded()))
|
||||
}
|
||||
|
||||
manifest = append(manifest, manifestItem{
|
||||
|
@ -380,7 +381,7 @@ func (s *saveSession) saveImage(id image.ID) (map[layer.DiffID]distribution.Desc
|
|||
}
|
||||
|
||||
var parent digest.Digest
|
||||
var layers []digest.Digest
|
||||
var layers []layer.DiffID
|
||||
var foreignSrcs map[layer.DiffID]distribution.Descriptor
|
||||
for i, diffID := range img.RootFS.DiffIDs {
|
||||
v1ImgCreated := time.Unix(0, 0)
|
||||
|
@ -410,7 +411,7 @@ func (s *saveSession) saveImage(id image.ID) (map[layer.DiffID]distribution.Desc
|
|||
return nil, err
|
||||
}
|
||||
|
||||
layers = append(layers, digest.Digest(diffID))
|
||||
layers = append(layers, diffID)
|
||||
parent = v1ID
|
||||
if src.Digest != "" {
|
||||
if foreignSrcs == nil {
|
||||
|
|
Loading…
Reference in a new issue