From 7d9ff46ebd13c53ea279e1553545c138288d8866 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 18 Jun 2021 18:01:14 +0200 Subject: [PATCH 1/2] revert input dir management to llb.Copy to fix cache for yarn source pkg Signed-off-by: Sam Alba --- environment/pipeline.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/environment/pipeline.go b/environment/pipeline.go index db6e9012..c3d33e6a 100644 --- a/environment/pipeline.go +++ b/environment/pipeline.go @@ -342,9 +342,20 @@ func (p *Pipeline) Local(ctx context.Context, op *compiler.Value, st llb.State) opts = append(opts, llb.ExcludePatterns(excludePatterns)) } - return llb.Local( - dir, - opts..., + // FIXME: Remove the `Copy` and use `Local` directly. + // + // Copy'ing is a costly operation which should be unnecessary. + // However, using llb.Local directly breaks caching sometimes for unknown reasons. + return st.File( + llb.Copy( + llb.Local( + dir, + opts..., + ), + "/", + "/", + ), + llb.WithCustomName(p.vertexNamef("Local %s [copy]", dir)), ), nil } From efed4f73ea3d52aa6ca359d63792e5457f50787f Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Mon, 21 Jun 2021 11:37:48 +0200 Subject: [PATCH 2/2] input/dir: ignore .dagger/ directory by default Signed-off-by: Sam Alba --- environment/pipeline.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/environment/pipeline.go b/environment/pipeline.go index c3d33e6a..28170def 100644 --- a/environment/pipeline.go +++ b/environment/pipeline.go @@ -329,8 +329,10 @@ func (p *Pipeline) Local(ctx context.Context, op *compiler.Value, st llb.State) if err != nil { return st, err } + + // Excludes .dagger directory by default + excludePatterns := []string{"**/.dagger/"} if len(excludes) > 0 { - excludePatterns := []string{} for _, i := range excludes { pattern, err := i.String() if err != nil { @@ -338,9 +340,8 @@ func (p *Pipeline) Local(ctx context.Context, op *compiler.Value, st llb.State) } excludePatterns = append(excludePatterns, pattern) } - - opts = append(opts, llb.ExcludePatterns(excludePatterns)) } + opts = append(opts, llb.ExcludePatterns(excludePatterns)) // FIXME: Remove the `Copy` and use `Local` directly. //