input to inputs

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones 2021-12-17 11:24:50 -07:00
parent 3c0d9c5acc
commit 03a740ff1e
No known key found for this signature in database
GPG Key ID: CFB3A382EB166F4C
6 changed files with 30 additions and 9 deletions

View File

@ -59,7 +59,7 @@ func (p *Plan) Source() *compiler.Value {
// registerLocalDirectories scans the context for local imports.
// BuildKit requires to known the list of directories ahead of time.
func (p *Plan) registerLocalDirs() error {
imports, err := p.source.Lookup("input.directories").Fields()
imports, err := p.source.Lookup("inputs.directories").Fields()
if err != nil {
return err
}

View File

@ -3,7 +3,7 @@ package engine
// A deployment plan executed by `dagger up`
#Plan: {
// Receive inputs from the client
input: {
inputs: {
// Receive directories
directories: [string]: _#inputDirectory
// Securely receive secrets

View File

@ -7,7 +7,7 @@ package engine
// A special kind of program which `dagger` can execute.
#DAG: {
// Receive inputs from the client
input: {
inputs: {
// Receive directories
directories: [name=string]: _#inputDirectory
// Securely receive secrets
@ -17,7 +17,7 @@ package engine
}
// Send outputs to the client
output: {
outputs: {
directories: [name=string]: _#outputDirectory
}

View File

@ -43,3 +43,10 @@ setup() {
cd "$TESTDIR"
"$DAGGER" --europa up ./plan/inputs/directories/exists.cue
}
@test "plan/inputs/directories conflicting values" {
cd "$TESTDIR"
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"'
}

View File

@ -0,0 +1,15 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
)
engine.#Plan & {
inputs: directories: test: path: "./plan/inputs/directories"
actions: verify: engine.#ReadFile & {
input: inputs.directories.test.contents
path: "test.txt"
} & {
contents: "local dfsadf" // should fail with conflicting values
}
}

View File

@ -1,16 +1,15 @@
package main
import (
"alpha.dagger.io/europa/dagger"
"alpha.dagger.io/europa/dagger/engine"
)
dagger.#Plan & {
input: directories: test: path: "./plan/inputs/directories"
engine.#Plan & {
inputs: directories: test: path: "./plan/inputs/directories"
actions: verify: engine.#ReadFile & {
input: input.directories.test.contents
input: inputs.directories.test.contents
path: "test.txt"
} & {
contents: "local directory\n"
contents: "local directory"
}
}