diff options
author | baude <bbaude@redhat.com> | 2018-06-27 08:55:20 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-27 15:16:02 +0000 |
commit | e1b47c15076680d318aa6fd0cb650ad89b471022 (patch) | |
tree | 4bf24b82c99533645484ce4ea57f75914f73c053 /vendor/github.com/projectatomic/buildah/commit.go | |
parent | f6c0fc1aa854ae5ce73d57ecb09d47c0d4dd2cc3 (diff) | |
download | podman-e1b47c15076680d318aa6fd0cb650ad89b471022.tar.gz podman-e1b47c15076680d318aa6fd0cb650ad89b471022.tar.bz2 podman-e1b47c15076680d318aa6fd0cb650ad89b471022.zip |
Vendor in latest buildah
Signed-off-by: baude <bbaude@redhat.com>
Closes: #1007
Approved by: baude
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/commit.go')
-rw-r--r-- | vendor/github.com/projectatomic/buildah/commit.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/vendor/github.com/projectatomic/buildah/commit.go b/vendor/github.com/projectatomic/buildah/commit.go index 3c5958f2d..b25ec7029 100644 --- a/vendor/github.com/projectatomic/buildah/commit.go +++ b/vendor/github.com/projectatomic/buildah/commit.go @@ -105,10 +105,17 @@ func (b *Builder) Commit(ctx context.Context, dest types.ImageReference, options logrus.Debugf("error destroying signature policy context: %v", err2) } }() - // Check if we're keeping everything in local storage. If so, we can take certain shortcuts. - _, destIsStorage := dest.Transport().(is.StoreTransport) - exporting := !destIsStorage - src, err := b.makeImageRef(options.PreferredManifestType, options.Parent, exporting, options.Squash, options.Compression, options.HistoryTimestamp) + // Check if the base image is already in the destination and it's some kind of local + // storage. If so, we can skip recompressing any layers that come from the base image. + exportBaseLayers := true + if transport, destIsStorage := dest.Transport().(is.StoreTransport); destIsStorage && b.FromImageID != "" { + if baseref, err := transport.ParseReference(b.FromImageID); baseref != nil && err == nil { + if img, err := transport.GetImage(baseref); img != nil && err == nil { + exportBaseLayers = false + } + } + } + src, err := b.makeImageRef(options.PreferredManifestType, options.Parent, exportBaseLayers, options.Squash, options.Compression, options.HistoryTimestamp) if err != nil { return imgID, errors.Wrapf(err, "error computing layer digests and building metadata") } |