feat: Allow default values in client: env (#2122)

Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
Helder Correia
2022-04-11 18:31:36 +00:00
committed by GitHub
parent 732ef96a06
commit 80ae63928b
4 changed files with 30 additions and 9 deletions

View File

@@ -190,7 +190,7 @@ setup() {
run "$DAGGER" "do" -p ./plan/client/env/usage.cue test
assert_failure
assert_output --regexp "environment variable \"TEST_(STRING|SECRET)\" not set"
assert_output --regexp "environment variable \"TEST_(STRING|DEFAULT|SECRET)\" not set"
}
@test "plan/client/env concrete" {

View File

@@ -9,6 +9,7 @@ dagger.#Plan & {
client: env: {
TEST_STRING: string
TEST_SECRET: dagger.#Secret
TEST_DEFAULT: string | *"hello world"
}
actions: {
image: core.#Pull & {
@@ -19,6 +20,10 @@ dagger.#Plan & {
input: image.output
args: ["test", client.env.TEST_STRING, "=", "foo"]
}
default: core.#Exec & {
input: image.output
args: ["test", client.env.TEST_DEFAULT, "=", "hello world"]
}
secret: core.#Exec & {
input: image.output
mounts: secret: {