From 2eba3f3ce00d4483ce365039623e0516c15cd825 Mon Sep 17 00:00:00 2001 From: Edgar Lee Date: Fri, 9 Apr 2021 15:49:36 -0700 Subject: [PATCH] Address comments --- codegen/builtin_fs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/codegen/builtin_fs.go b/codegen/builtin_fs.go index 99b4b643..46fdafa7 100644 --- a/codegen/builtin_fs.go +++ b/codegen/builtin_fs.go @@ -475,6 +475,7 @@ func (m Copy) Call(ctx context.Context, cln *client.Client, ret Register, opts O ) fs.SolveOpts = append(fs.SolveOpts, input.SolveOpts...) fs.SessionOpts = append(fs.SessionOpts, input.SessionOpts...) + commitHistory(fs.Image, false, "COPY %s %s", src, dest) return ret.Set(fs) } @@ -518,6 +519,10 @@ func (l Label) Call(ctx context.Context, cln *client.Client, ret Register, opts fs.Image.Config.Labels[key] = value + // In Dockerfile, multiple labels can be specified in the same LABEL command + // leading to one history element. This checks if the previous history + // committed was also a label, in which case it should just add to the + // previous history element. numHistory := len(fs.Image.History) if numHistory > 0 && strings.HasPrefix(fs.Image.History[numHistory-1].CreatedBy, "LABEL") { fs.Image.History[numHistory-1].CreatedBy = fmt.Sprintf("%s %s=%s", fs.Image.History[numHistory-1].CreatedBy, key, value)