From fb4a7256921b9863bd27079ec821b9612368fee8 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 19 Oct 2015 11:27:56 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20overwrite=20layer=20checksum=20?= =?UTF-8?q?on=20push?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After v1.8.3 layer checksum is used for image ID validation. Rewriting the checksums on push would mean that next pulls will get different image IDs and pulls may fail if its detected that same manifest digest can now point to new image ID. Fixes #17178 Signed-off-by: Tonis Tiigi --- graph/push_v2.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/graph/push_v2.go b/graph/push_v2.go index 70cb2e42a0..fe34733b13 100644 --- a/graph/push_v2.go +++ b/graph/push_v2.go @@ -169,15 +169,17 @@ func (p *v2Pusher) pushV2Tag(tag string) error { // if digest was empty or not saved, or if blob does not exist on the remote repository, // then fetch it. if !exists { - if pushDigest, err := p.pushV2Image(p.repo.Blobs(context.Background()), layer); err != nil { + var pushDigest digest.Digest + if pushDigest, err = p.pushV2Image(p.repo.Blobs(context.Background()), layer); err != nil { return err - } else if pushDigest != dgst { + } + if dgst == "" { // Cache new checksum if err := p.graph.SetLayerDigest(layer.ID, pushDigest); err != nil { return err } - dgst = pushDigest } + dgst = pushDigest } // read v1Compatibility config, generate new if needed