Report error if FS is incorrectly handled on client filesystem read

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
This commit is contained in:
Marcos Lilljedahl
2022-04-01 13:00:41 -03:00
parent 66153c6194
commit 7ffbef33b5
4 changed files with 41 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ import (
)
dagger.#Plan & {
// Reading a file into a dagger.#FS should not be possbile
client: filesystem: "../rootfs/test.txt": read: contents: dagger.#FS
actions: test: {
}

View File

@@ -0,0 +1,21 @@
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
// Reading a directory into a non-fs should fail
client: filesystem: "../rootfs": read: contents: string
actions: {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: core.#Exec & {
input: image.output
args: ["test", client.filesystem."../rootfs".read.contents]
}
}
}