Update to match newer storage and image-spec APIs
Update to adjust to new types and method signatures in just-updated vendored code. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> Closes: #174 Approved by: rhatdan
This commit is contained in:
parent
f46ed32a11
commit
12a3abf6fa
|
@ -176,7 +176,7 @@ func (b *Builder) shallowCopy(dest types.ImageReference, src types.ImageReferenc
|
|||
parentLayer = img.TopLayer
|
||||
}
|
||||
// Extract the read-write layer's contents.
|
||||
layerDiff, err := b.store.Diff(parentLayer, container.LayerID)
|
||||
layerDiff, err := b.store.Diff(parentLayer, container.LayerID, nil)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "error reading layer %q from source image %q", container.LayerID, transports.ImageName(src))
|
||||
}
|
||||
|
|
24
config.go
24
config.go
|
@ -21,8 +21,9 @@ func makeOCIv1Image(dimage *docker.V2Image) (ociv1.Image, error) {
|
|||
if config == nil {
|
||||
config = &dimage.ContainerConfig
|
||||
}
|
||||
dcreated := dimage.Created.UTC()
|
||||
image := ociv1.Image{
|
||||
Created: dimage.Created.UTC(),
|
||||
Created: &dcreated,
|
||||
Author: dimage.Author,
|
||||
Architecture: dimage.Architecture,
|
||||
OS: dimage.OS,
|
||||
|
@ -38,7 +39,7 @@ func makeOCIv1Image(dimage *docker.V2Image) (ociv1.Image, error) {
|
|||
},
|
||||
RootFS: ociv1.RootFS{
|
||||
Type: "",
|
||||
DiffIDs: []string{},
|
||||
DiffIDs: []digest.Digest{},
|
||||
},
|
||||
History: []ociv1.History{},
|
||||
}
|
||||
|
@ -51,13 +52,12 @@ func makeOCIv1Image(dimage *docker.V2Image) (ociv1.Image, error) {
|
|||
}
|
||||
if RootFS.Type == docker.TypeLayers {
|
||||
image.RootFS.Type = docker.TypeLayers
|
||||
for _, id := range RootFS.DiffIDs {
|
||||
image.RootFS.DiffIDs = append(image.RootFS.DiffIDs, id.String())
|
||||
}
|
||||
image.RootFS.DiffIDs = append(image.RootFS.DiffIDs, RootFS.DiffIDs...)
|
||||
}
|
||||
for _, history := range dimage.History {
|
||||
hcreated := history.Created.UTC()
|
||||
ohistory := ociv1.History{
|
||||
Created: history.Created.UTC(),
|
||||
Created: &hcreated,
|
||||
CreatedBy: history.CreatedBy,
|
||||
Author: history.Author,
|
||||
Comment: history.Comment,
|
||||
|
@ -98,13 +98,7 @@ func makeDockerV2S2Image(oimage *ociv1.Image) (docker.V2Image, error) {
|
|||
}
|
||||
if oimage.RootFS.Type == docker.TypeLayers {
|
||||
image.RootFS.Type = docker.TypeLayers
|
||||
for _, id := range oimage.RootFS.DiffIDs {
|
||||
d, err := digest.Parse(id)
|
||||
if err != nil {
|
||||
return docker.V2Image{}, err
|
||||
}
|
||||
image.RootFS.DiffIDs = append(image.RootFS.DiffIDs, d)
|
||||
}
|
||||
image.RootFS.DiffIDs = append(image.RootFS.DiffIDs, oimage.RootFS.DiffIDs...)
|
||||
}
|
||||
for _, history := range oimage.History {
|
||||
dhistory := docker.V2S2History{
|
||||
|
@ -224,8 +218,8 @@ func (b *Builder) fixupConfig() {
|
|||
if b.Docker.Created.IsZero() {
|
||||
b.Docker.Created = now
|
||||
}
|
||||
if b.OCIv1.Created.IsZero() {
|
||||
b.OCIv1.Created = now
|
||||
if b.OCIv1.Created == nil || b.OCIv1.Created.IsZero() {
|
||||
b.OCIv1.Created = &now
|
||||
}
|
||||
if b.OS() == "" {
|
||||
b.SetOS(runtime.GOOS)
|
||||
|
|
10
image.go
10
image.go
|
@ -172,7 +172,7 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
|
|||
}
|
||||
|
||||
oimage.RootFS.Type = docker.TypeLayers
|
||||
oimage.RootFS.DiffIDs = []string{}
|
||||
oimage.RootFS.DiffIDs = []digest.Digest{}
|
||||
dimage.RootFS = &docker.V2S2RootFS{}
|
||||
dimage.RootFS.Type = docker.TypeLayers
|
||||
dimage.RootFS.DiffIDs = []digest.Digest{}
|
||||
|
@ -215,12 +215,12 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
|
|||
dmanifest.Layers = append(dmanifest.Layers, dlayerDescriptor)
|
||||
// Add a note about the diffID, which should be uncompressed digest of the blob, but
|
||||
// just use the layer ID here.
|
||||
oimage.RootFS.DiffIDs = append(oimage.RootFS.DiffIDs, fakeLayerDigest.String())
|
||||
oimage.RootFS.DiffIDs = append(oimage.RootFS.DiffIDs, fakeLayerDigest)
|
||||
dimage.RootFS.DiffIDs = append(dimage.RootFS.DiffIDs, fakeLayerDigest)
|
||||
continue
|
||||
}
|
||||
// Start reading the layer.
|
||||
rc, err := i.store.Diff("", layerID)
|
||||
rc, err := i.store.Diff("", layerID, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error extracting layer %q", layerID)
|
||||
}
|
||||
|
@ -283,14 +283,14 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
|
|||
}
|
||||
dmanifest.Layers = append(dmanifest.Layers, dlayerDescriptor)
|
||||
// Add a note about the diffID, which is always an uncompressed value.
|
||||
oimage.RootFS.DiffIDs = append(oimage.RootFS.DiffIDs, srcHasher.Digest().String())
|
||||
oimage.RootFS.DiffIDs = append(oimage.RootFS.DiffIDs, srcHasher.Digest())
|
||||
dimage.RootFS.DiffIDs = append(dimage.RootFS.DiffIDs, srcHasher.Digest())
|
||||
}
|
||||
|
||||
if i.addHistory {
|
||||
// Build history notes in the image configurations.
|
||||
onews := v1.History{
|
||||
Created: i.created,
|
||||
Created: &i.created,
|
||||
CreatedBy: i.createdBy,
|
||||
Author: oimage.Author,
|
||||
EmptyLayer: false,
|
||||
|
|
Loading…
Reference in New Issue