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

@@ -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"
"""#,
]
}
}
}