#@Rajat Jindal In my testing, of v0.13.3
1 messages · Page 1 of 1 (latest)
encountered during testing above
dagger-cache-volume-issue ➤ docker ps git:main*
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5ce3b73a40b5 registry.dagger.io/engine:v0.13.3 "dagger-entrypoint.s…" 3 minutes ago Up 3 minutes dagger-engine-v0.13.3
947f780d025a justincormack/nsenter1 "/usr/bin/nsenter1" 3 hours ago Up 3 hours gracious_galois
dagger-cache-volume-issue ➤ docker rm -f 5ce3b73a40b5 git:main*
5ce3b73a40b5
dagger-cache-volume-issue ➤ dagger -s call nginx-two git:main*
_type: Container
defaultArgs:
- nginx
- -g
- daemon off;
entrypoint:
- /docker-entrypoint.sh
mounts:
- /nginx-two-foo-cache
platform: linux/arm64
user: ""
workdir: ""
dagger-cache-volume-issue ➤ dagger -s call list-cache git:main*
Error: response from query: input: foo.listCache resolve: call function "ListCache": process "/runtime" did not complete successfully: exit code: 2
Stdout:
invoke: input: container.from.withMountedCache.withExec.stdout resolve: process "sh -c ls -al /foo-cache/ && cat /foo-cache/bar.txt" did not complete successfully: exit code: 1
Stdout:
total 12
drwxr-xr-x 3 root root 4096 Oct 5 22:23 .
drwxr-xr-x 1 root root 4096 Oct 5 22:23 ..
drwxr-xr-x 2 root root 4096 Oct 5 22:23 nginx-two-was-here-too
Stderr:
cat: can't open '/foo-cache/bar.txt': No such file or directory
dagger-cache-volume-issue ➤ dagger -s call nginx git:main*
_type: Container
defaultArgs:
- nginx
- -g
- daemon off;
entrypoint:
- /docker-entrypoint.sh
mounts:
- /nginx-foo-cache
platform: linux/arm64
user: ""
workdir: ""
dagger-cache-volume-issue ➤ dagger -s call list-cache git:main*
Error: response from query: input: foo.listCache resolve: call function "ListCache": process "/runtime" did not complete successfully: exit code: 2
Stdout:
invoke: input: container.from.withMountedCache.withExec.stdout resolve: process "sh -c ls -al /foo-cache/ && cat /foo-cache/bar.txt" did not complete successfully: exit code: 1
Stdout:
total 16
drwxr-xr-x 4 root root 4096 Oct 5 22:23 .
drwxr-xr-x 1 root root 4096 Oct 5 22:23 ..
drwxr-xr-x 2 root root 4096 Oct 5 22:23 nginx-two-was-here-too
drwxr-xr-x 2 root root 4096 Oct 5 22:23 nginx-was-here
Stderr:
cat: can't open '/foo-cache/bar.txt': No such file or directory
dagger-cache-volume-issue ➤ dagger call populate-cache --input aksjdfksahdfk git:main*
✔ connect 0.3s
✔ initialize 0.4s
✔ prepare 0.0s
✔ foo: Foo! 0.0s
✔ Foo.populateCache(input: "aksjdfksahdfk"): Container! 1.4s
✔ Container.sync: ContainerID! 4.1s
✔ Container.defaultArgs: [String!]! 0.0s
✔ Container.mounts: [String!]! 0.0s
✔ Container.user: String! 0.0s
✔ Container.workdir: String! 0.0s
✔ Container.entrypoint: [String!]! 0.0s
✔ Container.platform: Platform! 0.0s
Full trace at https://dagger.cloud/test-jeremy-dagger-org-301/traces/0a0a8205d4f5019ef5da01054b2509f5
_type: Container
defaultArgs:
- bash
entrypoint: []
mounts:
- /foo-cache
platform: linux/arm64
user: ""
workdir: ""
dagger-cache-volume-issue ➤ dagger -s call list-cache git:main*
total 48
drwxr-xr-x 11 root root 4096 Oct 5 22:24 .
drwxr-xr-x 1 root root 4096 Oct 5 22:24 ..
drwxr-xr-x 2 root root 4096 Oct 5 22:24 aksjdfksahdfk
-rw-r--r-- 1 root root 14 Oct 5 22:24 bar.txt
drwxr-xr-x 2 root root 4096 Oct 5 22:24 cat
drwxr-xr-x 2 root root 4096 Oct 5 22:24 dog
drwxr-xr-x 2 root root 4096 Oct 5 22:24 fuzz
drwxr-xr-x 2 root root 4096 Oct 5 22:24 gads
drwxr-xr-x 2 root root 4096 Oct 5 22:24 last-one
drwxr-xr-x 2 root root 4096 Oct 5 22:23 nginx-two-was-here-too
drwxr-xr-x 2 root root 4096 Oct 5 22:23 nginx-was-here
drwxr-xr-x 2 root root 4096 Oct 5 22:24 one-more
aksjdfksahdfk
hmmm...here I could use drop various directories inside of the cache volume and things worked out...not conflicts on write, I suppose.
dagger-cache-volume-issue ➤ dagger -s call populate-cache --input tada git:main*
_type: Container
defaultArgs:
- bash
entrypoint: []
mounts:
- /foo-cache
platform: linux/arm64
user: ""
workdir: ""
dagger-cache-volume-issue ➤ dagger -s call list-cache git:main*
total 40
drwxr-xr-x 9 root root 4096 Oct 5 23:03 .
drwxr-xr-x 1 root root 4096 Oct 5 23:06 ..
-rw-r--r-- 1 root root 5 Oct 5 23:03 bar.txt
drwxr-xr-x 2 root root 4096 Oct 5 23:03 cat
drwxr-xr-x 2 root root 4096 Oct 5 23:03 dog
drwxr-xr-x 2 root root 4096 Oct 5 23:03 fuzz
drwxr-xr-x 2 root root 4096 Oct 5 23:03 gads
drwxr-xr-x 2 root root 4096 Oct 5 23:03 last-one
drwxr-xr-x 2 root root 4096 Oct 5 23:03 one-more
drwxr-xr-x 2 root root 4096 Oct 5 23:03 tada
tada
dagger-cache-volume-issue ➤ dagger -s call nginx git:main*
_type: Container
defaultArgs:
- nginx
- -g
- daemon off;
entrypoint:
- /docker-entrypoint.sh
mounts:
- /nginx-foo-cache
platform: linux/arm64
user: ""
workdir: ""
dagger-cache-volume-issue ➤ dagger -s call list-cache git:main*
total 40
drwxr-xr-x 9 root root 4096 Oct 5 23:03 .
drwxr-xr-x 1 root root 4096 Oct 5 23:06 ..
-rw-r--r-- 1 root root 5 Oct 5 23:03 bar.txt
drwxr-xr-x 2 root root 4096 Oct 5 23:03 cat
drwxr-xr-x 2 root root 4096 Oct 5 23:03 dog
drwxr-xr-x 2 root root 4096 Oct 5 23:03 fuzz
drwxr-xr-x 2 root root 4096 Oct 5 23:03 gads
drwxr-xr-x 2 root root 4096 Oct 5 23:03 last-one
drwxr-xr-x 2 root root 4096 Oct 5 23:03 one-more
drwxr-xr-x 2 root root 4096 Oct 5 23:03 tada
tada
like this 👆 where I couldn't add the nginx-was-here on top of the stuff that populate dropped, while I was able to do it the other way around...
@indigo spear @timber parrot it seems the difference is whether I've done something like
Nuclear option:
docker stop $(docker ps -a -q -f 'name=dagger-engine')
docker rm $(docker ps -a -q -f 'name=dagger-engine')
docker system prune -f -a --volumes
Engine-only option:
or just a docker rm -f <dagger engine container id>
=======
In both cases, I end up with an apparently empty cache-volume, but in the Engine-only removal option, I can use nginx and then populate-cache to get a union of both contents when I run list-cache, but if I run in the other order of populate-cache and then nginx, I only see the contents contributed by populate-cache for some reason when I list-cache, as if the cache-volume is. no longer writable for a new directory contributed by nginx, though you can still see the union if you run
dagger -s call populate-cache --input tada
dagger call nginx terminal
If I use the Nuclear option, I can do it in either order.
package main
import (
"context"
"dagger/foo/internal/dagger"
"fmt"
)
type Foo struct{}
func (f *Foo) Nginx() *dagger.Container {
return dag.Container().From("nginx:latest").
WithMountedCache("/nginx-foo-cache", dag.CacheVolume("foo-cache")).
WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /nginx-foo-cache/%s", "nginx-was-here")})
}
func (f *Foo) PopulateCache(ctx context.Context, input string) *dagger.Container {
ctr := dag.Container().From("debian:latest").
WithMountedCache("/foo-cache", dag.CacheVolume("foo-cache")).
WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /foo-cache/%s", input)}).
WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /foo-cache/%s", "dog")}).
WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /foo-cache/%s", "cat")}).
WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /foo-cache/%s", "fuzz")}).
WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /foo-cache/%s", "gads")}).
WithExec([]string{"sh", "-c", fmt.Sprintf("echo '%s' > /foo-cache/bar.txt", input)})
ctr = f.OneMore(ctx, ctr)
return ctr.WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /foo-cache/%s", "last-one")})
}
func (f *Foo) OneMore(ctx context.Context, ctr *dagger.Container) *dagger.Container {
return ctr.WithExec([]string{"sh", "-c", fmt.Sprintf("mkdir -p /foo-cache/%s", "one-more")})
}
func (f *Foo) ListCache(ctx context.Context) (string, error) {
return dag.
Container().
From("alpine:latest").
WithMountedCache("/foo-cache", dag.CacheVolume("foo-cache")).
WithExec([]string{"sh", "-c", "ls -al /foo-cache/ && cat /foo-cache/bar.txt"}).
Stdout(ctx)
}
dagger -s call populate-cache --input tada
dagger -s call nginx
dagger -s call list-cache
dagger -s call nginx
dagger -s call populate-cache --input tada
dagger -s call list-cache