removed dagger up in favor of dagger do

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones
2022-03-09 11:45:46 -07:00
parent 945b7293af
commit 6b81dc439d
34 changed files with 286 additions and 536 deletions

View File

@@ -19,28 +19,29 @@ dagger.#Plan & {
"""#,
]
}
test: {
verify_file: dagger.#ReadFile & {
input: exec.output
path: "/output.txt"
} & {
// assert result
contents: "hello world"
}
verify_file: dagger.#ReadFile & {
input: exec.output
path: "/output.txt"
} & {
// assert result
contents: "hello world"
}
copy: dagger.#Copy & {
input: image.output
contents: exec.output
source: "/output.txt"
dest: "/output.txt"
}
copy: dagger.#Copy & {
input: image.output
contents: exec.output
source: "/output.txt"
dest: "/output.txt"
}
verify_copy: dagger.#ReadFile & {
input: copy.output
path: "/output.txt"
} & {
// assert result
contents: "hello world"
verify_copy: dagger.#ReadFile & {
input: copy.output
path: "/output.txt"
} & {
// assert result
contents: "hello world"
}
}
}
}

View File

@@ -20,26 +20,28 @@ dagger.#Plan & {
]
}
verify_file: dagger.#ReadFile & {
input: exec.output
path: "/output.txt"
} & {
// assert result
contents: "hello world from dagger"
}
test: {
verify_file: dagger.#ReadFile & {
input: exec.output
path: "/output.txt"
} & {
// assert result
contents: "hello world from dagger"
}
copy: dagger.#Copy & {
input: image.output
contents: exec.output
source: "/output.txt"
dest: "/output.txt"
}
verify_copy: dagger.#ReadFile & {
input: copy.output
path: "/output.txt"
} & {
// assert result
contents: "hello world"
copy: dagger.#Copy & {
input: image.output
contents: exec.output
source: "/output.txt"
dest: "/output.txt"
}
verify_copy: dagger.#ReadFile & {
input: copy.output
path: "/output.txt"
} & {
// assert result
contents: "hello world"
}
}
}
}

View File

@@ -14,27 +14,29 @@ dagger.#Plan & {
source: "busybox:1.34.1-glibc@sha256:ec98391b8f0911db08be2ee6c46813eeac17b9625b402ea1ce45dcfcd05d78d6"
}
verify_alpine_3_15_0: dagger.#ReadFile & {
input: alpine3_15_0.output
path: "/etc/alpine-release"
} & {
// assert result
contents: "3.15.0\n"
}
test: {
verify_alpine_3_15_0: dagger.#ReadFile & {
input: alpine3_15_0.output
path: "/etc/alpine-release"
} & {
// assert result
contents: "3.15.0\n"
}
copy: dagger.#Copy & {
input: busybox1_34_1.output
contents: alpine3_15_0.output
source: "/etc/alpine-release"
dest: "/alpine3_15_0_release"
}
copy: dagger.#Copy & {
input: busybox1_34_1.output
contents: alpine3_15_0.output
source: "/etc/alpine-release"
dest: "/alpine3_15_0_release"
}
verify_copy: dagger.#ReadFile & {
input: copy.output
path: "/alpine3_15_0_release"
} & {
// assert result
contents: "3.15.0\n"
verify_copy: dagger.#ReadFile & {
input: copy.output
path: "/alpine3_15_0_release"
} & {
// assert result
contents: "3.15.0\n"
}
}
}
}

View File

@@ -22,73 +22,3 @@ dagger.#Plan & {
}
}
}
// TestDockerfilePath: #up: [
// op.#DockerBuild & {
// context: TestData
// dockerfilePath: "./dockerfilepath/Dockerfile.custom"
// },
// op.#Exec & {
// args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
// },
// ]
// TestBuildArgs: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// ARG TEST=foo
// RUN test "${TEST}" = "bar"
// """
// buildArg: TEST: "bar"
// },
// ]
// // FIXME: this doesn't test anything beside not crashing
// TestBuildLabels: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// """
// label: FOO: "bar"
// },
// ]
// // FIXME: this doesn't test anything beside not crashing
// TestBuildPlatform: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// """
// platforms: ["linux/amd64"]
// },
// ]
// TestImageMetadata: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// ENV CHECK foobar
// ENV DOUBLECHECK test
// """
// },
// op.#Exec & {
// args: ["sh", "-c", #"""
// env
// test "$CHECK" = "foobar"
// """#]
// },
// ]
// // Make sure the metadata is carried over with a `Load`
// TestImageMetadataIndirect: #up: [
// op.#Load & {
// from: TestImageMetadata
// },
// op.#Exec & {
// args: ["sh", "-c", #"""
// env
// test "$DOUBLECHECK" = "test"
// """#]
// },
// ]

View File

@@ -23,73 +23,3 @@ dagger.#Plan & {
}
}
}
// TestDockerfilePath: #up: [
// op.#DockerBuild & {
// context: TestData
// dockerfilePath: "./dockerfilepath/Dockerfile.custom"
// },
// op.#Exec & {
// args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
// },
// ]
// TestBuildArgs: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// ARG TEST=foo
// RUN test "${TEST}" = "bar"
// """
// buildArg: TEST: "bar"
// },
// ]
// // FIXME: this doesn't test anything beside not crashing
// TestBuildLabels: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// """
// label: FOO: "bar"
// },
// ]
// // FIXME: this doesn't test anything beside not crashing
// TestBuildPlatform: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// """
// platforms: ["linux/amd64"]
// },
// ]
// TestImageMetadata: #up: [
// op.#DockerBuild & {
// dockerfile: """
// FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
// ENV CHECK foobar
// ENV DOUBLECHECK test
// """
// },
// op.#Exec & {
// args: ["sh", "-c", #"""
// env
// test "$CHECK" = "foobar"
// """#]
// },
// ]
// // Make sure the metadata is carried over with a `Load`
// TestImageMetadataIndirect: #up: [
// op.#Load & {
// from: TestImageMetadata
// },
// op.#Exec & {
// args: ["sh", "-c", #"""
// env
// test "$DOUBLECHECK" = "test"
// """#]
// },
// ]

View File

@@ -6,6 +6,7 @@ import (
dagger.#Plan & {
client: filesystem: "secret.txt": read: contents: dagger.#Secret
actions: {
image: dagger.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"

View File

@@ -28,36 +28,38 @@ dagger.#Plan & {
]
}
verify: dagger.#Exec & {
input: image.output
mounts: cache: {
dest: "/cache"
contents: exec.mounts.cache.contents
test: {
verify: dagger.#Exec & {
input: image.output
mounts: cache: {
dest: "/cache"
contents: exec.mounts.cache.contents
}
args: [
"sh", "-c",
#"""
test -f /cache/output.txt
test "$(cat /cache/output.txt)" = "hello world"
"""#,
]
}
args: [
"sh", "-c",
#"""
test -f /cache/output.txt
test "$(cat /cache/output.txt)" = "hello world"
"""#,
]
}
otherCache: dagger.#CacheDir & {
id: "othercache"
}
verifyOtherCache: dagger.#Exec & {
input: image.output
mounts: cache: {
dest: "/cache"
contents: otherCache
otherCache: dagger.#CacheDir & {
id: "othercache"
}
verifyOtherCache: dagger.#Exec & {
input: image.output
mounts: cache: {
dest: "/cache"
contents: otherCache
}
args: [
"sh", "-c",
#"""
test ! -f /cache/output.txt
"""#,
]
}
args: [
"sh", "-c",
#"""
test ! -f /cache/output.txt
"""#,
]
}
}
}

View File

@@ -20,52 +20,54 @@ dagger.#Plan & {
]
}
verify: dagger.#Exec & {
input: image.output
mounts: fs: {
dest: "/target"
contents: exec.output
test: {
verify: dagger.#Exec & {
input: image.output
mounts: fs: {
dest: "/target"
contents: exec.output
}
args: [
"sh", "-c",
#"""
test "$(cat /target/output.txt)" = "hello world"
touch /target/rw
"""#,
]
}
args: [
"sh", "-c",
#"""
test "$(cat /target/output.txt)" = "hello world"
touch /target/rw
"""#,
]
}
verifyRO: dagger.#Exec & {
input: image.output
mounts: fs: {
dest: "/target"
contents: exec.output
ro: true
verifyRO: dagger.#Exec & {
input: image.output
mounts: fs: {
dest: "/target"
contents: exec.output
ro: true
}
args: [
"sh", "-c",
#"""
test "$(cat /target/output.txt)" = "hello world"
touch /target/ro && exit 1
true
"""#,
]
}
args: [
"sh", "-c",
#"""
test "$(cat /target/output.txt)" = "hello world"
touch /target/ro && exit 1
true
"""#,
]
}
verifySource: dagger.#Exec & {
input: image.output
mounts: fs: {
dest: "/target.txt"
contents: exec.output
source: "/output.txt"
verifySource: dagger.#Exec & {
input: image.output
mounts: fs: {
dest: "/target.txt"
contents: exec.output
source: "/output.txt"
}
args: [
"sh", "-c",
#"""
test "$(cat /target.txt)" = "hello world"
"""#,
]
}
args: [
"sh", "-c",
#"""
test "$(cat /target.txt)" = "hello world"
"""#,
]
}
}
}

View File

@@ -11,39 +11,40 @@ dagger.#Plan & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
verify: dagger.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"
contents: client.env.TESTSECRET
test: {
verify: dagger.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"
contents: client.env.TESTSECRET
}
args: [
"sh", "-c",
#"""
test "$(cat /run/secrets/test)" = "hello world"
ls -l /run/secrets/test | grep -- "-r--------"
"""#,
]
}
args: [
"sh", "-c",
#"""
test "$(cat /run/secrets/test)" = "hello world"
ls -l /run/secrets/test | grep -- "-r--------"
"""#,
]
}
verifyPerm: dagger.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"
contents: client.env.TESTSECRET
uid: 42
gid: 24
mask: 0o666
verifyPerm: dagger.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"
contents: client.env.TESTSECRET
uid: 42
gid: 24
mask: 0o666
}
args: [
"sh", "-c",
#"""
ls -l /run/secrets/test | grep -- "-rw-rw-rw-"
ls -l /run/secrets/test | grep -- "42"
ls -l /run/secrets/test | grep -- "24"
"""#,
]
}
args: [
"sh", "-c",
#"""
ls -l /run/secrets/test | grep -- "-rw-rw-rw-"
ls -l /run/secrets/test | grep -- "42"
ls -l /run/secrets/test | grep -- "24"
"""#,
]
}
}
}

View File

@@ -14,28 +14,28 @@ dagger.#Plan & {
input: image.output
args: ["adduser", "-D", "test"]
}
test: {
verifyUsername: dagger.#Exec & {
input: addUser.output
user: "test"
args: [
"sh", "-c",
#"""
test "$(whoami)" = "test"
"""#,
]
}
verifyUsername: dagger.#Exec & {
input: addUser.output
user: "test"
args: [
"sh", "-c",
#"""
test "$(whoami)" = "test"
"""#,
]
verifyUserID: dagger.#Exec & {
input: addUser.output
user: "1000"
args: [
"sh", "-c",
#"""
test "$(whoami)" = "test"
"""#,
]
}
}
verifyUserID: dagger.#Exec & {
input: addUser.output
user: "1000"
args: [
"sh", "-c",
#"""
test "$(whoami)" = "test"
"""#,
]
}
}
}

View File

@@ -23,20 +23,22 @@ dagger.#Plan & {
args: ["/src/test.sh"]
}
verifyHello: dagger.#ReadFile & {
input: source.output
path: "/world.txt"
} & {
// assert result
contents: "world\n"
}
test: {
verifyHello: dagger.#ReadFile & {
input: source.output
path: "/world.txt"
} & {
// assert result
contents: "world\n"
}
verifyWorld: dagger.#ReadFile & {
input: exec.output
path: "/test.txt"
} & {
// assert result
contents: "hello world"
verifyWorld: dagger.#ReadFile & {
input: exec.output
path: "/test.txt"
} & {
// assert result
contents: "hello world"
}
}
}
}