From c27194b35f56a1bea6e37f58e549230823653dc3 Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Mon, 24 Jan 2022 14:22:28 +0000 Subject: [PATCH] Show digest of pushed images (#1737) * Show digest of pushed images * Non-fatal log * Make easier to copy and paste --- container/go/cmd/pusher/pusher.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/container/go/cmd/pusher/pusher.go b/container/go/cmd/pusher/pusher.go index 5d553b042..ab0257414 100644 --- a/container/go/cmd/pusher/pusher.go +++ b/container/go/cmd/pusher/pusher.go @@ -121,11 +121,21 @@ func main() { log.Printf("Destination %s was resolved to %s after stamping.", *dst, stamped) } + digest, err := img.Digest() + if err != nil { + log.Printf("Failed to digest image: %v", err) + } + if err := push(stamped, img); err != nil { log.Fatalf("Error pushing image to %s: %v", stamped, err) } - log.Printf("Successfully pushed %s image to %s", *format, stamped) + digestStr := "" + if !strings.Contains(stamped, "@") { + digestStr = fmt.Sprintf(" - %s@%s", strings.Split(stamped, ":")[0], digest) + } + + log.Printf("Successfully pushed %s image to %s%s", *format, stamped, digestStr) } // digestExists checks whether an image's digest exists in a repository.