From a0658aa1d0cc7a7f1bcc4a3af9155335b6943f40 Mon Sep 17 00:00:00 2001 From: alex weidner Date: Mon, 8 Jan 2024 14:52:14 -0500 Subject: [PATCH] Always print pushed digest in crane push (#1860) --- cmd/crane/cmd/push.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/crane/cmd/push.go b/cmd/crane/cmd/push.go index cfd9f98b1..05eedf16f 100644 --- a/cmd/crane/cmd/push.go +++ b/cmd/crane/cmd/push.go @@ -71,7 +71,9 @@ func NewCmdPush(options *[]crane.Option) *cobra.Command { digest := ref.Context().Digest(h.String()) if imageRefs != "" { - return os.WriteFile(imageRefs, []byte(digest.String()), 0600) + if err := os.WriteFile(imageRefs, []byte(digest.String()), 0600); err != nil { + return fmt.Errorf("failed to write image refs to %s: %w", imageRefs, err) + } } // Print the digest of the pushed image to stdout to facilitate command composition.