secret exec

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones
2021-12-17 14:41:09 -07:00
parent 7b7ee5455f
commit 5ef138fe84
5 changed files with 132 additions and 1 deletions

View File

@@ -56,4 +56,16 @@ setup() {
run "$DAGGER" --europa up ./plan/inputs/directories/conflicting_values.cue
assert_failure
assert_output --partial 'failed to up environment: actions.verify.contents: conflicting values "local directory" and "local dfsadf"'
}
}
@test "plan/inputs/secrets exec" {
cd "$TESTDIR"
"$DAGGER" --europa up ./plan/inputs/secrets/exec.cue
}
@test "plan/inputs/secrets invalid command" {
cd "$TESTDIR"
run "$DAGGER" --europa up ./plan/inputs/secrets/invalid_command.cue
assert_failure
assert_output --partial 'failed: exec: "rtyet": executable file not found in $PATH'
}

View File

@@ -0,0 +1,34 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
)
engine.#Plan & {
inputs: secrets: echo: command: {
name: "echo"
args: ["hello europa"]
}
actions: {
image: engine.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
verify: engine.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"
contents: inputs.secrets.echo.contents
}
args: [
"sh", "-c",
#"""
test "$(cat /run/secrets/test)" = "hello europa"
ls -l /run/secrets/test | grep -- "-r--------"
"""#,
]
}
}
}

View File

@@ -0,0 +1,34 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
)
engine.#Plan & {
inputs: secrets: echo: command: {
name: "rtyet" // should fail because command doesnt exist
args: ["hello europa"]
}
actions: {
image: engine.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
verify: engine.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"
contents: inputs.secrets.echo.contents
}
args: [
"sh", "-c",
#"""
test "$(cat /run/secrets/test)" = "hello europa"
ls -l /run/secrets/test | grep -- "-r--------"
"""#,
]
}
}
}