From 36f9a387ff2a2684e6ae7e48d787ca1fa74fdcd2 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Fri, 11 Feb 2022 10:39:19 -0500 Subject: [PATCH] Log base image@digest when building (#592) * Log base image@digest when building * Only log full digest if the original base wasn't already specified by digest * Remove redundant image ref --- pkg/commands/config.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/commands/config.go b/pkg/commands/config.go index 201ff63bdf..9dd2f114bd 100644 --- a/pkg/commands/config.go +++ b/pkg/commands/config.go @@ -106,12 +106,21 @@ func getBaseImage(bo *options.BuildOptions) build.GetBase { return ref, cached, nil } - log.Printf("Using base %s for %s", ref, s) result, err := fetch(ctx, ref) if err != nil { return ref, result, err } + if _, ok := ref.(name.Digest); ok { + log.Printf("Using base %s for %s", ref, s) + } else { + dig, err := result.Digest() + if err != nil { + return ref, result, err + } + log.Printf("Using base %s@%s for %s", ref, dig, s) + } + cache[ref.String()] = result return ref, result, nil }