Update to match API changes in dependencies

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai
2017-02-13 11:44:47 -05:00
parent 165f985fc3
commit 22422cc399
3 changed files with 16 additions and 23 deletions

View File

@@ -11,12 +11,8 @@ import (
)
func copyDockerImageConfig(dimage *docker.Image) (ociv1.Image, error) {
created, err := dimage.Created.UTC().MarshalText()
if err != nil {
created = []byte{}
}
image := ociv1.Image{
Created: string(created),
Created: dimage.Created.UTC(),
Author: dimage.Author,
Architecture: dimage.Architecture,
OS: dimage.OS,
@@ -50,12 +46,9 @@ func copyDockerImageConfig(dimage *docker.Image) (ociv1.Image, error) {
}
}
for _, history := range dimage.History {
created, err := history.Created.UTC().MarshalText()
if err != nil {
created = []byte{}
}
created := history.Created.UTC()
ohistory := ociv1.History{
Created: string(created),
Created: created,
CreatedBy: history.CreatedBy,
Author: history.Author,
Comment: history.Comment,
@@ -81,10 +74,7 @@ func (b *Builder) updatedConfig() []byte {
}
}
}
createdBytes, err := time.Now().UTC().MarshalText()
if err == nil {
image.Created = string(createdBytes)
}
image.Created = time.Now().UTC()
if image.Architecture == "" {
image.Architecture = runtime.GOARCH
}
@@ -103,6 +93,11 @@ func (b *Builder) updatedConfig() []byte {
if b.User != "" {
image.Config.User = b.User
}
if len(b.Volumes) > 0 {
for _, volSpec := range b.Volumes {
image.Config.Volumes[volSpec] = struct{}{}
}
}
if b.Workdir != "" {
image.Config.WorkingDir = b.Workdir
}

View File

@@ -85,10 +85,7 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
}
logrus.Debugf("layer list: %q", layers)
createdDate, err := time.Now().UTC().MarshalText()
if err != nil {
return nil, err
}
created := time.Now().UTC()
path, err := ioutil.TempDir(os.TempDir(), Package)
if err != nil {
@@ -149,7 +146,7 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
if i.compression != archive.Uncompressed {
switch i.compression {
case archive.Gzip:
mediaType = MediaTypeImageLayerGzip
mediaType = v1.MediaTypeImageLayerGzip
logrus.Debugf("compressing layer %q with gzip", layerID)
case archive.Bzip2:
logrus.Debugf("compressing layer %q with bzip2", layerID)
@@ -178,7 +175,7 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
err = os.Rename(filepath.Join(path, "layer"), filepath.Join(path, destHasher.Digest().String()))
layerDescriptor := v1.Descriptor{
MediaType: mediaType,
Digest: destHasher.Digest().String(),
Digest: destHasher.Digest(),
Size: size,
}
manifest.Layers = append(manifest.Layers, layerDescriptor)
@@ -187,7 +184,7 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
}
news := v1.History{
Created: string(createdDate),
Created: created,
CreatedBy: i.createdBy,
Author: image.Author,
EmptyLayer: false,
@@ -201,7 +198,7 @@ func (i *containerImageRef) NewImageSource(sc *types.SystemContext, manifestType
logrus.Debugf("config = %s\n", config)
i.config = config
manifest.Config.Digest = digest.FromBytes(config).String()
manifest.Config.Digest = digest.FromBytes(config)
manifest.Config.Size = int64(len(config))
mfest, err := json.Marshal(&manifest)

View File

@@ -5,6 +5,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/containers/image/copy"
"github.com/containers/image/docker/reference"
"github.com/containers/image/signature"
is "github.com/containers/image/storage"
"github.com/containers/image/transports"
@@ -30,7 +31,7 @@ func pullImage(store storage.Store, options BuilderOptions, sc *types.SystemCont
}
if ref := srcRef.DockerReference(); ref != nil {
name = ref.FullName()
name = reference.Domain(ref) + "/" + reference.Path(ref)
}
destRef, err := is.Transport.ParseStoreReference(store, name)