From e7863eb6646ffbe9e45ece8f0bafd3ae339d8d97 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 4 Mar 2022 15:27:04 +0100 Subject: [PATCH] build: return imageID when loading without docker driver Signed-off-by: CrazyMax --- build/build.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build/build.go b/build/build.go index b6da2fa5..5362d4a7 100644 --- a/build/build.go +++ b/build/build.go @@ -762,9 +762,12 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do resp[k] = res[0] respMu.Unlock() if len(res) == 1 { - digest := res[0].ExporterResponse["containerimage.digest"] + dgst := res[0].ExporterResponse[exptypes.ExporterImageDigestKey] + if v, ok := res[0].ExporterResponse[exptypes.ExporterImageConfigDigestKey]; ok { + dgst = v + } if opt.ImageIDFile != "" { - return ioutil.WriteFile(opt.ImageIDFile, []byte(digest), 0644) + return ioutil.WriteFile(opt.ImageIDFile, []byte(dgst), 0644) } return nil } @@ -774,7 +777,7 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do descs := make([]specs.Descriptor, 0, len(res)) for _, r := range res { - s, ok := r.ExporterResponse["containerimage.digest"] + s, ok := r.ExporterResponse[exptypes.ExporterImageDigestKey] if ok { descs = append(descs, specs.Descriptor{ Digest: digest.Digest(s),