From b41adbd9c2cbf1f14f5accdb62395fa5f3fad576 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Wed, 9 Jun 2021 15:21:30 +0200 Subject: [PATCH 1/2] stdlib/os: fixed typo in container.cue (dest cache folder was always "true") Signed-off-by: Sam Alba --- stdlib/os/container.cue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/os/container.cue b/stdlib/os/container.cue index 035de1c3..2f06aff0 100644 --- a/stdlib/os/container.cue +++ b/stdlib/os/container.cue @@ -113,10 +113,10 @@ import ( "\(dest)": o // FIXME: support source path } - for dest in cache { + for dest, _ in cache { "\(dest)": "cache" } - for dest in tmpfs { + for dest, _ in tmpfs { "\(dest)": "tmpfs" } } From 09617b89da523827225758e416377b62f38e54c8 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Wed, 9 Jun 2021 15:22:06 +0200 Subject: [PATCH 2/2] core: replaced persistent cache mounts with directory Signed-off-by: Sam Alba --- environment/pipeline.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/environment/pipeline.go b/environment/pipeline.go index 08c4f74b..db6e9012 100644 --- a/environment/pipeline.go +++ b/environment/pipeline.go @@ -456,11 +456,16 @@ func (p *Pipeline) mount(ctx context.Context, dest string, mnt *compiler.Value) case "cache": return llb.AddMount( dest, - llb.Scratch(), - llb.AsPersistentCacheDir( - p.canonicalPath(mnt), - llb.CacheMountShared, + llb.Scratch().File( + llb.Mkdir("/cache", fs.FileMode(0755)), + llb.WithCustomName(p.vertexNamef("Mkdir /cache (cache mount %s)", dest)), ), + // FIXME: disabled persistent cache mount (gh issue #495) + // llb.Scratch(), + // llb.AsPersistentCacheDir( + // p.canonicalPath(mnt), + // llb.CacheMountShared, + // ), ), nil case "tmpfs": return llb.AddMount(