From 498b204eb94a40f082bb0b405c8515014938cde0 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Wed, 15 Dec 2021 14:15:44 -0700 Subject: [PATCH 01/22] reorganized files Signed-off-by: Richard Jones --- tests/plan/{context/services => proxy}/incomplete_service.cue | 0 tests/plan/{context/services => proxy}/incomplete_unix.cue | 0 tests/plan/{context/services => proxy}/invalid_schema.cue | 0 tests/plan/{context/services => proxy}/invalid_value.cue | 0 tests/plan/{context/services => proxy}/unix.cue | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename tests/plan/{context/services => proxy}/incomplete_service.cue (100%) rename tests/plan/{context/services => proxy}/incomplete_unix.cue (100%) rename tests/plan/{context/services => proxy}/invalid_schema.cue (100%) rename tests/plan/{context/services => proxy}/invalid_value.cue (100%) rename tests/plan/{context/services => proxy}/unix.cue (100%) diff --git a/tests/plan/context/services/incomplete_service.cue b/tests/plan/proxy/incomplete_service.cue similarity index 100% rename from tests/plan/context/services/incomplete_service.cue rename to tests/plan/proxy/incomplete_service.cue diff --git a/tests/plan/context/services/incomplete_unix.cue b/tests/plan/proxy/incomplete_unix.cue similarity index 100% rename from tests/plan/context/services/incomplete_unix.cue rename to tests/plan/proxy/incomplete_unix.cue diff --git a/tests/plan/context/services/invalid_schema.cue b/tests/plan/proxy/invalid_schema.cue similarity index 100% rename from tests/plan/context/services/invalid_schema.cue rename to tests/plan/proxy/invalid_schema.cue diff --git a/tests/plan/context/services/invalid_value.cue b/tests/plan/proxy/invalid_value.cue similarity index 100% rename from tests/plan/context/services/invalid_value.cue rename to tests/plan/proxy/invalid_value.cue diff --git a/tests/plan/context/services/unix.cue b/tests/plan/proxy/unix.cue similarity index 100% rename from tests/plan/context/services/unix.cue rename to tests/plan/proxy/unix.cue From c15a7c6d229274ececf5c18c941ce45697d53db2 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 12:21:17 -0700 Subject: [PATCH 02/22] reorganized spec vs implemented, reconciled gap Signed-off-by: Richard Jones --- stdlib/europa/dagger/engine/plan.cue | 99 ++++++++++------- .../europa/dagger/engine/spec/engine/plan.cue | 102 +++++++++++++++++ stdlib/europa/dagger/plan.cue | 103 +----------------- stdlib/europa/dagger/types.cue | 10 +- stdlib/europa/dagger/utils.cue | 2 +- 5 files changed, 168 insertions(+), 148 deletions(-) create mode 100644 stdlib/europa/dagger/engine/spec/engine/plan.cue diff --git a/stdlib/europa/dagger/engine/plan.cue b/stdlib/europa/dagger/engine/plan.cue index a5ac386a..f8570203 100644 --- a/stdlib/europa/dagger/engine/plan.cue +++ b/stdlib/europa/dagger/engine/plan.cue @@ -2,50 +2,71 @@ package engine // A deployment plan executed by `dagger up` #Plan: { - context: #Context - actions: [string]: _ + // Receive inputs from the client + input: { + // Receive directories + directories: [string]: _#inputDirectory + // Securely receive secrets + secrets: [string]: _#inputSecret + } + + // Forward network services to and from the client + proxy: [string]: _#proxyEndpoint + + // Execute actions in containers + actions: { + ... + } } -// FIXME: Platform spec here -#Platform: string +_#inputDirectory: { + // Import from this path ON THE CLIENT MACHINE + // Example: "/Users/Alice/dev/todoapp/src" + _type: "LocalDirectory" + path: string -#Context: { - // Platform to target - platform?: #Platform + // Filename patterns to include + // Example: ["*.go", "Dockerfile"] + include?: [...string] - // Import directories - imports: [string]: { - _type: "Import" + // Filename patterns to exclude + // Example: ["node_modules"] + exclude?: [...string] + // Imported filesystem contents + // Use this as input for actions requiring an #FS field + contents: #FS +} + +// Securely receive a secret from the client +_#inputSecret: { + // Reference to the secret contents + // Use this by securely mounting it into a container. + // See universe.dagger.io/docker.#Run.mounts + // FIXME: `contents` field name causes confusion (not actually the secret contents..) + contents: #Secret + + { + // Read secret from a file ON THE CLIENT MACHINE + _type: "SecretFile" path: string - include?: [...string] - exclude?: [...string] - fs: #FS - } - - // Securely load external secrets - secrets: [string]: { - // Secrets can be securely mounted into action containers as a file - contents: #Secret - - { - _type: "SecretFile" - // Read secret from a file - path: string - } | { - _type: "SecretEnv" - // Read secret from an environment variable ON THE CLIENT MACHINE - envvar: string - } - } - - services: [string]: { - service: #Service - _type: "Service" - { - unix: string - } | { - npipe: string - } + } | { + // Read secret from an environment variable ON THE CLIENT MACHINE + _type: "SecretEnv" + envvar: string + } +} + +// Forward a network endpoint to and from the client +_#proxyEndpoint: { + // Service endpoint can be proxied to action containers as unix sockets + // FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard... + // FIXME: reconcile with spec + _type: "Service" + service: #Service + { + unix: string + } | { + npipe: string } } diff --git a/stdlib/europa/dagger/engine/spec/engine/plan.cue b/stdlib/europa/dagger/engine/spec/engine/plan.cue new file mode 100644 index 00000000..239af48f --- /dev/null +++ b/stdlib/europa/dagger/engine/spec/engine/plan.cue @@ -0,0 +1,102 @@ +// The Dagger API. +package dagger + +// A deployment plan executed by `dagger up` +#Plan: #DAG + +// A special kind of program which `dagger` can execute. +#DAG: { + // Receive inputs from the client + input: { + // Receive directories + directories: [name=string]: _#inputDirectory + // Securely receive secrets + secrets: [name=string]: _#inputSecret + // Receive runtime parameters + params: [name=string]: _ + } + + // Send outputs to the client + output: { + directories: [name=string]: _#outputDirectory + } + + // Forward network services to and from the client + proxy: [name=string]: _#proxyEndpoint + + // Execute actions in containers + actions: { + ... + } +} + +_#inputDirectory: { + // Import from this path ON THE CLIENT MACHINE + // Example: "/Users/Alice/dev/todoapp/src" + source: string + + // Filename patterns to include + // Example: ["*.go", "Dockerfile"] + include?: [...string] + + // Filename patterns to exclude + // Example: ["node_modules"] + exclude?: [...string] + + // Imported filesystem contents + // Use this as input for actions requiring an #FS field + contents: #FS +} + +_#outputDirectory: { + // Filesystem contents to export + // Reference an #FS field produced by an action + contents: #FS + + // Export to this path ON THE CLIENT MACHINE + dest: string +} + +// Securely receive a secret from the client +_#inputSecret: { + // Reference to the secret contents + // Use this by securely mounting it into a container. + // See universe.dagger.io/docker.#Run.mounts + // FIXME: `contents` field name causes confusion (not actually the secret contents..) + contents: #Secret + + { + // Execute a command ON THE CLIENT MACHINE and read secret from standard output + command: [string, ...string] | string + // Execute command in an interactive terminal + // for example to prompt for a passphrase + interactive: true | *false + } | { + // Read secret from a file ON THE CLIENT MACHINE + path: string + } | { + // Read secret from an environment variable ON THE CLIENT MACHINE + envvar: string + } +} + +// Forward a network endpoint to and from the client +_#proxyEndpoint: { + // Service endpoint can be proxied to action containers as unix sockets + // FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard... + endpoint: #Service + + { + // Listen for connections ON THE CLIENT MACHINE, proxy to actions + listen: #Address + } | { + // Connect to a remote endpoint FROM THE CLIENT MACHINE, proxy to actions + connect: #Address + } | { + // Proxy to/from the contents of a file ON THE CLIENT MACHINE + filepath: string + } | { + // Proxy to/from standard input and output of a command ON THE CLIENT MACHINE + command: [string, ...string] | string + } +} diff --git a/stdlib/europa/dagger/plan.cue b/stdlib/europa/dagger/plan.cue index 239af48f..b3c5a5a2 100644 --- a/stdlib/europa/dagger/plan.cue +++ b/stdlib/europa/dagger/plan.cue @@ -1,102 +1,7 @@ -// The Dagger API. package dagger -// A deployment plan executed by `dagger up` -#Plan: #DAG +import ( + "alpha.dagger.io/europa/dagger/engine" +) -// A special kind of program which `dagger` can execute. -#DAG: { - // Receive inputs from the client - input: { - // Receive directories - directories: [name=string]: _#inputDirectory - // Securely receive secrets - secrets: [name=string]: _#inputSecret - // Receive runtime parameters - params: [name=string]: _ - } - - // Send outputs to the client - output: { - directories: [name=string]: _#outputDirectory - } - - // Forward network services to and from the client - proxy: [name=string]: _#proxyEndpoint - - // Execute actions in containers - actions: { - ... - } -} - -_#inputDirectory: { - // Import from this path ON THE CLIENT MACHINE - // Example: "/Users/Alice/dev/todoapp/src" - source: string - - // Filename patterns to include - // Example: ["*.go", "Dockerfile"] - include?: [...string] - - // Filename patterns to exclude - // Example: ["node_modules"] - exclude?: [...string] - - // Imported filesystem contents - // Use this as input for actions requiring an #FS field - contents: #FS -} - -_#outputDirectory: { - // Filesystem contents to export - // Reference an #FS field produced by an action - contents: #FS - - // Export to this path ON THE CLIENT MACHINE - dest: string -} - -// Securely receive a secret from the client -_#inputSecret: { - // Reference to the secret contents - // Use this by securely mounting it into a container. - // See universe.dagger.io/docker.#Run.mounts - // FIXME: `contents` field name causes confusion (not actually the secret contents..) - contents: #Secret - - { - // Execute a command ON THE CLIENT MACHINE and read secret from standard output - command: [string, ...string] | string - // Execute command in an interactive terminal - // for example to prompt for a passphrase - interactive: true | *false - } | { - // Read secret from a file ON THE CLIENT MACHINE - path: string - } | { - // Read secret from an environment variable ON THE CLIENT MACHINE - envvar: string - } -} - -// Forward a network endpoint to and from the client -_#proxyEndpoint: { - // Service endpoint can be proxied to action containers as unix sockets - // FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard... - endpoint: #Service - - { - // Listen for connections ON THE CLIENT MACHINE, proxy to actions - listen: #Address - } | { - // Connect to a remote endpoint FROM THE CLIENT MACHINE, proxy to actions - connect: #Address - } | { - // Proxy to/from the contents of a file ON THE CLIENT MACHINE - filepath: string - } | { - // Proxy to/from standard input and output of a command ON THE CLIENT MACHINE - command: [string, ...string] | string - } -} +#Plan: engine.#Plan \ No newline at end of file diff --git a/stdlib/europa/dagger/types.cue b/stdlib/europa/dagger/types.cue index e71790df..9594ef52 100644 --- a/stdlib/europa/dagger/types.cue +++ b/stdlib/europa/dagger/types.cue @@ -1,7 +1,7 @@ package dagger import ( - "alpha.dagger.io/europa/dagger/engine/spec/engine" + "alpha.dagger.io/europa/dagger/engine" ) // A reference to a filesystem tree. @@ -20,17 +20,9 @@ import ( // by a special filesystem mount designed to minimize leak risk. #Secret: engine.#Secret -// A reference to a stream of bytes, for example: -// - The standard output or error stream of a command -// - The standard input stream of a command -// - The contents of a file or named pipe -#Stream: engine.#Stream - // A reference to a network service endpoint, for example: // - A TCP or UDP port // - A unix socket // - An HTTPS endpoint #Service: engine.#Service -// A network service address -#Address: string & =~"^(tcp://|unix://|udp://).*" diff --git a/stdlib/europa/dagger/utils.cue b/stdlib/europa/dagger/utils.cue index 29adf65b..bb9fccc4 100644 --- a/stdlib/europa/dagger/utils.cue +++ b/stdlib/europa/dagger/utils.cue @@ -1,7 +1,7 @@ package dagger import ( - "alpha.dagger.io/europa/dagger/engine/spec/engine" + "alpha.dagger.io/europa/dagger/engine" ) // Select a subdirectory from a filesystem tree From 4768425037c167d420b78f05e6a836339287bd92 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 12:22:36 -0700 Subject: [PATCH 03/22] renamed Import to LocalDirectory Signed-off-by: Richard Jones --- plan/task/{import.go => localDirectory.go} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename plan/task/{import.go => localDirectory.go} (83%) diff --git a/plan/task/import.go b/plan/task/localDirectory.go similarity index 83% rename from plan/task/import.go rename to plan/task/localDirectory.go index 30d09cd9..f01e9d96 100644 --- a/plan/task/import.go +++ b/plan/task/localDirectory.go @@ -10,13 +10,13 @@ import ( ) func init() { - Register("Import", func() Task { return &importTask{} }) + Register("LocalDirectory", func() Task { return &localDirectoryTask{} }) } -type importTask struct { +type localDirectoryTask struct { } -func (c importTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { +func (c localDirectoryTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { var dir struct { Path string Include []string @@ -69,6 +69,6 @@ func (c importTask) Run(ctx context.Context, pctx *plancontext.Context, s solver fs := pctx.FS.New(result) return compiler.NewValue().FillFields(map[string]interface{}{ - "fs": fs.MarshalCUE(), + "contents": fs.MarshalCUE(), }) } From 0ed63273446ef869dfe12c5423ba9129a503972c Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 12:29:40 -0700 Subject: [PATCH 04/22] refactored tests to account for lib reorg Signed-off-by: Richard Jones --- tests/plan/hello-europa/main.cue | 4 ++-- tests/plan/proxy/incomplete_service.cue | 6 +++--- tests/plan/proxy/incomplete_unix.cue | 6 +++--- tests/plan/proxy/invalid_schema.cue | 4 ++-- tests/plan/proxy/invalid_value.cue | 4 ++-- tests/plan/proxy/unix.cue | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/plan/hello-europa/main.cue b/tests/plan/hello-europa/main.cue index 4459013a..2e4b152f 100644 --- a/tests/plan/hello-europa/main.cue +++ b/tests/plan/hello-europa/main.cue @@ -1,11 +1,11 @@ package main import ( - "alpha.dagger.io/europa/dagger/engine" + "alpha.dagger.io/europa/dagger" "alpha.dagger.io/os" ) -engine.#Plan & { +dagger.#Plan & { actions: { sayHello: os.#Container & { command: "echo Hello Europa! > /out.txt" diff --git a/tests/plan/proxy/incomplete_service.cue b/tests/plan/proxy/incomplete_service.cue index 33adbc79..a8432ab9 100644 --- a/tests/plan/proxy/incomplete_service.cue +++ b/tests/plan/proxy/incomplete_service.cue @@ -7,8 +7,8 @@ import ( ) engine.#Plan & { - // should fail - context: services: dockerSocket: {} + // should fail due to incomplete service + proxy: dockerSocket: {} actions: test: #up: [ op.#Load & { @@ -19,7 +19,7 @@ engine.#Plan & { op.#Exec & { always: true - mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service + mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["docker", "info"] }, ] diff --git a/tests/plan/proxy/incomplete_unix.cue b/tests/plan/proxy/incomplete_unix.cue index 379dc8bc..475368bc 100644 --- a/tests/plan/proxy/incomplete_unix.cue +++ b/tests/plan/proxy/incomplete_unix.cue @@ -7,8 +7,8 @@ import ( ) engine.#Plan & { - // should succeed - context: services: dockerSocket: unix: string + // should fail because incomplete value + proxy: dockerSocket: unix: string actions: test: #up: [ op.#Load & { @@ -19,7 +19,7 @@ engine.#Plan & { op.#Exec & { always: true - mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service + mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["docker", "info"] }, ] diff --git a/tests/plan/proxy/invalid_schema.cue b/tests/plan/proxy/invalid_schema.cue index bf19f9d2..d7f5b174 100644 --- a/tests/plan/proxy/invalid_schema.cue +++ b/tests/plan/proxy/invalid_schema.cue @@ -8,7 +8,7 @@ import ( engine.#Plan & { // should fail because of misspelled key - context: services: dockerSocket: unx: "/var/run/docker.soc" + proxy: dockerSocket: unx: "/var/run/docker.sock" actions: test: #up: [ op.#Load & { @@ -19,7 +19,7 @@ engine.#Plan & { op.#Exec & { always: true - mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service + mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["docker", "info"] }, ] diff --git a/tests/plan/proxy/invalid_value.cue b/tests/plan/proxy/invalid_value.cue index 1dcba88c..6844fe61 100644 --- a/tests/plan/proxy/invalid_value.cue +++ b/tests/plan/proxy/invalid_value.cue @@ -8,7 +8,7 @@ import ( engine.#Plan & { // should fail because of misspelled value - context: services: dockerSocket: unix: "/var/run/docker.soc" + proxy: dockerSocket: unix: "/var/run/docker.soc" actions: test: #up: [ op.#Load & { @@ -19,7 +19,7 @@ engine.#Plan & { op.#Exec & { always: true - mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service + mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["docker", "info"] }, ] diff --git a/tests/plan/proxy/unix.cue b/tests/plan/proxy/unix.cue index 3e1fc723..bc3ae101 100644 --- a/tests/plan/proxy/unix.cue +++ b/tests/plan/proxy/unix.cue @@ -8,7 +8,7 @@ import ( engine.#Plan & { // should succeed - context: services: dockerSocket: unix: "/var/run/docker.sock" + proxy: dockerSocket: unix: "/var/run/docker.sock" actions: test: #up: [ op.#Load & { @@ -19,7 +19,7 @@ engine.#Plan & { op.#Exec & { always: true - mount: "/var/run/docker.sock": stream: context.services.dockerSocket.service + mount: "/var/run/docker.sock": stream: proxy.dockerSocket.service args: ["docker", "info"] }, ] From 73e12296d31b2957cd058db8c87101430a0ac95f Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 12:30:09 -0700 Subject: [PATCH 05/22] added new test for input directories Signed-off-by: Richard Jones --- tests/plan.bats | 25 ++++++++++++++---------- tests/plan/inputs/directories/exists.cue | 10 ++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 tests/plan/inputs/directories/exists.cue diff --git a/tests/plan.bats b/tests/plan.bats index f99567ef..222dc085 100644 --- a/tests/plan.bats +++ b/tests/plan.bats @@ -10,31 +10,36 @@ setup() { "$DAGGER" --europa up ./plan/hello-europa } -@test "plan/context/services invalid schema" { +@test "plan/proxy invalid schema" { cd "$TESTDIR" - run "$DAGGER" --europa up ./plan/context/services/invalid_schema.cue + run "$DAGGER" --europa up ./plan/proxy/invalid_schema.cue assert_failure } -@test "plan/context/services invalid value" { +@test "plan/proxy invalid value" { cd "$TESTDIR" - run "$DAGGER" --europa up ./plan/context/services/invalid_value.cue + run "$DAGGER" --europa up ./plan/proxy/invalid_value.cue assert_failure } -@test "plan/context/services incomplete unix" { +@test "plan/proxy incomplete unix" { cd "$TESTDIR" - run "$DAGGER" --europa up ./plan/context/services/incomplete_unix.cue + run "$DAGGER" --europa up ./plan/proxy/incomplete_unix.cue assert_failure } -@test "plan/context/services incomplete service" { +@test "plan/proxy incomplete service" { cd "$TESTDIR" - run "$DAGGER" --europa up ./plan/context/services/incomplete_service.cue + run "$DAGGER" --europa up ./plan/proxy/incomplete_service.cue assert_output --partial "pipeline was partially executed because of missing inputs" } -@test "plan/context/services unix" { +@test "plan/proxy unix" { cd "$TESTDIR" - "$DAGGER" --europa up ./plan/context/services/unix.cue + "$DAGGER" --europa up ./plan/proxy/unix.cue +} + +@test "plan/inputs/directories exists" { + cd "$TESTDIR" + "$DAGGER" --europa up ./plan/inputs/directories/exists.cue } \ No newline at end of file diff --git a/tests/plan/inputs/directories/exists.cue b/tests/plan/inputs/directories/exists.cue new file mode 100644 index 00000000..9d66e4ef --- /dev/null +++ b/tests/plan/inputs/directories/exists.cue @@ -0,0 +1,10 @@ +package main + +import ( + "alpha.dagger.io/europa/dagger" +) + +dagger.#Plan & { + input: directories: test: path: "./plan/inputs/directories" + actions: verify: input.directories.test.contents +} From 3224a0aeabfab1067ddb58fdcd0e69e56be36a8e Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 12:43:50 -0700 Subject: [PATCH 06/22] cue fmt Signed-off-by: Richard Jones --- stdlib/europa/dagger/engine/plan.cue | 12 ++++++------ stdlib/europa/dagger/engine/spec/engine/plan.cue | 2 +- stdlib/europa/dagger/plan.cue | 4 ++-- stdlib/europa/dagger/types.cue | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/stdlib/europa/dagger/engine/plan.cue b/stdlib/europa/dagger/engine/plan.cue index f8570203..941d1b46 100644 --- a/stdlib/europa/dagger/engine/plan.cue +++ b/stdlib/europa/dagger/engine/plan.cue @@ -22,8 +22,8 @@ package engine _#inputDirectory: { // Import from this path ON THE CLIENT MACHINE // Example: "/Users/Alice/dev/todoapp/src" - _type: "LocalDirectory" - path: string + _type: "LocalDirectory" + path: string // Filename patterns to include // Example: ["*.go", "Dockerfile"] @@ -48,11 +48,11 @@ _#inputSecret: { { // Read secret from a file ON THE CLIENT MACHINE - _type: "SecretFile" - path: string + _type: "SecretFile" + path: string } | { // Read secret from an environment variable ON THE CLIENT MACHINE - _type: "SecretEnv" + _type: "SecretEnv" envvar: string } } @@ -62,7 +62,7 @@ _#proxyEndpoint: { // Service endpoint can be proxied to action containers as unix sockets // FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard... // FIXME: reconcile with spec - _type: "Service" + _type: "Service" service: #Service { unix: string diff --git a/stdlib/europa/dagger/engine/spec/engine/plan.cue b/stdlib/europa/dagger/engine/spec/engine/plan.cue index 239af48f..ab4ecc57 100644 --- a/stdlib/europa/dagger/engine/spec/engine/plan.cue +++ b/stdlib/europa/dagger/engine/spec/engine/plan.cue @@ -1,5 +1,5 @@ // The Dagger API. -package dagger +package engine // A deployment plan executed by `dagger up` #Plan: #DAG diff --git a/stdlib/europa/dagger/plan.cue b/stdlib/europa/dagger/plan.cue index b3c5a5a2..49afa5f1 100644 --- a/stdlib/europa/dagger/plan.cue +++ b/stdlib/europa/dagger/plan.cue @@ -1,7 +1,7 @@ package dagger import ( - "alpha.dagger.io/europa/dagger/engine" + "alpha.dagger.io/europa/dagger/engine" ) -#Plan: engine.#Plan \ No newline at end of file +#Plan: engine.#Plan diff --git a/stdlib/europa/dagger/types.cue b/stdlib/europa/dagger/types.cue index 9594ef52..e870546b 100644 --- a/stdlib/europa/dagger/types.cue +++ b/stdlib/europa/dagger/types.cue @@ -25,4 +25,3 @@ import ( // - A unix socket // - An HTTPS endpoint #Service: engine.#Service - From ba91f15cc766694ad23d1287eedd102cde5427f4 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 12:54:07 -0700 Subject: [PATCH 07/22] moved to spec because engine.#Copy is currently unimplemented Signed-off-by: Richard Jones --- stdlib/europa/dagger/{ => engine/spec/engine}/utils.cue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename stdlib/europa/dagger/{ => engine/spec/engine}/utils.cue (86%) diff --git a/stdlib/europa/dagger/utils.cue b/stdlib/europa/dagger/engine/spec/engine/utils.cue similarity index 86% rename from stdlib/europa/dagger/utils.cue rename to stdlib/europa/dagger/engine/spec/engine/utils.cue index bb9fccc4..29adf65b 100644 --- a/stdlib/europa/dagger/utils.cue +++ b/stdlib/europa/dagger/engine/spec/engine/utils.cue @@ -1,7 +1,7 @@ package dagger import ( - "alpha.dagger.io/europa/dagger/engine" + "alpha.dagger.io/europa/dagger/engine/spec/engine" ) // Select a subdirectory from a filesystem tree From 8ce33f63e4f7324d5cdce3e521efaf4dd6564263 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 13:02:09 -0700 Subject: [PATCH 08/22] adding #Address back to the engine schema Signed-off-by: Richard Jones --- stdlib/europa/dagger/engine/spec/engine/address.cue | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 stdlib/europa/dagger/engine/spec/engine/address.cue diff --git a/stdlib/europa/dagger/engine/spec/engine/address.cue b/stdlib/europa/dagger/engine/spec/engine/address.cue new file mode 100644 index 00000000..ee1802e8 --- /dev/null +++ b/stdlib/europa/dagger/engine/spec/engine/address.cue @@ -0,0 +1,4 @@ +package engine + +// A network service address +#Address: string & =~"^(tcp://|unix://|udp://).*" \ No newline at end of file From a7e285e7873ea4ba81d9803b9550dee8073c519a Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 13:14:53 -0700 Subject: [PATCH 09/22] cue fmt and package name fix Signed-off-by: Richard Jones --- stdlib/europa/dagger/engine/spec/engine/address.cue | 2 +- stdlib/europa/dagger/engine/spec/engine/utils.cue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/europa/dagger/engine/spec/engine/address.cue b/stdlib/europa/dagger/engine/spec/engine/address.cue index ee1802e8..908275ca 100644 --- a/stdlib/europa/dagger/engine/spec/engine/address.cue +++ b/stdlib/europa/dagger/engine/spec/engine/address.cue @@ -1,4 +1,4 @@ package engine // A network service address -#Address: string & =~"^(tcp://|unix://|udp://).*" \ No newline at end of file +#Address: string & =~"^(tcp://|unix://|udp://).*" diff --git a/stdlib/europa/dagger/engine/spec/engine/utils.cue b/stdlib/europa/dagger/engine/spec/engine/utils.cue index 29adf65b..929c21bc 100644 --- a/stdlib/europa/dagger/engine/spec/engine/utils.cue +++ b/stdlib/europa/dagger/engine/spec/engine/utils.cue @@ -1,4 +1,4 @@ -package dagger +package engine import ( "alpha.dagger.io/europa/dagger/engine/spec/engine" From d43bc7dc539cfc3cff62c316d461b99426298322 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 13:26:10 -0700 Subject: [PATCH 10/22] context -> input Signed-off-by: Richard Jones --- plan/plan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plan/plan.go b/plan/plan.go index 483afe7d..ab749426 100644 --- a/plan/plan.go +++ b/plan/plan.go @@ -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("context.imports").Fields() + imports, err := p.source.Lookup("input.directories").Fields() if err != nil { return err } From f50311de351807ea589b4c7bf746629b3ce14a37 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 14:10:50 -0700 Subject: [PATCH 11/22] refactored test to use #ReadFile Signed-off-by: Richard Jones --- tests/plan/inputs/directories/exists.cue | 8 +++++++- tests/plan/inputs/directories/test.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/plan/inputs/directories/test.txt diff --git a/tests/plan/inputs/directories/exists.cue b/tests/plan/inputs/directories/exists.cue index 9d66e4ef..24b7e2c8 100644 --- a/tests/plan/inputs/directories/exists.cue +++ b/tests/plan/inputs/directories/exists.cue @@ -2,9 +2,15 @@ package main import ( "alpha.dagger.io/europa/dagger" + "alpha.dagger.io/europa/dagger/engine" ) dagger.#Plan & { input: directories: test: path: "./plan/inputs/directories" - actions: verify: input.directories.test.contents + actions: verify: engine.#ReadFile & { + input: input.directories.test.contents + path: "test.txt" + } & { + contents: "local directory\n" + } } diff --git a/tests/plan/inputs/directories/test.txt b/tests/plan/inputs/directories/test.txt new file mode 100644 index 00000000..85b0daa3 --- /dev/null +++ b/tests/plan/inputs/directories/test.txt @@ -0,0 +1 @@ +local directory \ No newline at end of file From eebbfcb2585d058f7e15e54ccf868574ebc0d445 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 14:39:34 -0700 Subject: [PATCH 12/22] added debug message Signed-off-by: Richard Jones --- plan/task/localDirectory.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plan/task/localDirectory.go b/plan/task/localDirectory.go index f01e9d96..289c55fa 100644 --- a/plan/task/localDirectory.go +++ b/plan/task/localDirectory.go @@ -4,6 +4,7 @@ import ( "context" "github.com/moby/buildkit/client/llb" + "github.com/rs/zerolog/log" "go.dagger.io/dagger/compiler" "go.dagger.io/dagger/plancontext" "go.dagger.io/dagger/solver" @@ -27,6 +28,8 @@ func (c localDirectoryTask) Run(ctx context.Context, pctx *plancontext.Context, return nil, err } + lg := log.Ctx(ctx) + lg.Debug().Str("path", dir.Path).Msg("loading local directory") opts := []llb.LocalOption{ withCustomName(v, "Local %s", dir.Path), // Without hint, multiple `llb.Local` operations on the From 3c0d9c5accf7a781b5b5bbed7434ba0b3e7346db Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 16 Dec 2021 14:40:01 -0700 Subject: [PATCH 13/22] cue fmt Signed-off-by: Richard Jones --- tests/plan/inputs/directories/exists.cue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plan/inputs/directories/exists.cue b/tests/plan/inputs/directories/exists.cue index 24b7e2c8..d709f2ff 100644 --- a/tests/plan/inputs/directories/exists.cue +++ b/tests/plan/inputs/directories/exists.cue @@ -9,7 +9,7 @@ dagger.#Plan & { input: directories: test: path: "./plan/inputs/directories" actions: verify: engine.#ReadFile & { input: input.directories.test.contents - path: "test.txt" + path: "test.txt" } & { contents: "local directory\n" } From 03a740ff1e09473d3184706ebc76df9340bf76fe Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 11:24:50 -0700 Subject: [PATCH 14/22] input to inputs Signed-off-by: Richard Jones --- plan/plan.go | 2 +- stdlib/europa/dagger/engine/plan.cue | 2 +- stdlib/europa/dagger/engine/spec/engine/plan.cue | 4 ++-- tests/plan.bats | 7 +++++++ .../inputs/directories/conflicting_values.cue | 15 +++++++++++++++ tests/plan/inputs/directories/exists.cue | 9 ++++----- 6 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 tests/plan/inputs/directories/conflicting_values.cue diff --git a/plan/plan.go b/plan/plan.go index ab749426..ad7b58ad 100644 --- a/plan/plan.go +++ b/plan/plan.go @@ -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 } diff --git a/stdlib/europa/dagger/engine/plan.cue b/stdlib/europa/dagger/engine/plan.cue index 941d1b46..d813666f 100644 --- a/stdlib/europa/dagger/engine/plan.cue +++ b/stdlib/europa/dagger/engine/plan.cue @@ -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 diff --git a/stdlib/europa/dagger/engine/spec/engine/plan.cue b/stdlib/europa/dagger/engine/spec/engine/plan.cue index ab4ecc57..423c31b8 100644 --- a/stdlib/europa/dagger/engine/spec/engine/plan.cue +++ b/stdlib/europa/dagger/engine/spec/engine/plan.cue @@ -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 } diff --git a/tests/plan.bats b/tests/plan.bats index 222dc085..b2e29e32 100644 --- a/tests/plan.bats +++ b/tests/plan.bats @@ -42,4 +42,11 @@ setup() { @test "plan/inputs/directories exists" { 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"' } \ No newline at end of file diff --git a/tests/plan/inputs/directories/conflicting_values.cue b/tests/plan/inputs/directories/conflicting_values.cue new file mode 100644 index 00000000..69f3694f --- /dev/null +++ b/tests/plan/inputs/directories/conflicting_values.cue @@ -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 + } +} diff --git a/tests/plan/inputs/directories/exists.cue b/tests/plan/inputs/directories/exists.cue index d709f2ff..76201c34 100644 --- a/tests/plan/inputs/directories/exists.cue +++ b/tests/plan/inputs/directories/exists.cue @@ -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" } } From 140d753d9c03aad4725f0aae68392dfb596ed417 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 11:41:08 -0700 Subject: [PATCH 15/22] moving some things back to package dagger Signed-off-by: Richard Jones --- stdlib/europa/dagger/plan.cue | 2 +- stdlib/europa/dagger/types.cue | 6 +++++- stdlib/europa/dagger/{engine/spec/engine => }/utils.cue | 2 +- tests/plan/hello-europa/main.cue | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) rename stdlib/europa/dagger/{engine/spec/engine => }/utils.cue (96%) diff --git a/stdlib/europa/dagger/plan.cue b/stdlib/europa/dagger/plan.cue index 49afa5f1..223f6cd2 100644 --- a/stdlib/europa/dagger/plan.cue +++ b/stdlib/europa/dagger/plan.cue @@ -1,7 +1,7 @@ package dagger import ( - "alpha.dagger.io/europa/dagger/engine" + "alpha.dagger.io/europa/dagger/engine/spec/engine" ) #Plan: engine.#Plan diff --git a/stdlib/europa/dagger/types.cue b/stdlib/europa/dagger/types.cue index e870546b..14740b6c 100644 --- a/stdlib/europa/dagger/types.cue +++ b/stdlib/europa/dagger/types.cue @@ -1,7 +1,7 @@ package dagger import ( - "alpha.dagger.io/europa/dagger/engine" + "alpha.dagger.io/europa/dagger/engine/spec/engine" ) // A reference to a filesystem tree. @@ -25,3 +25,7 @@ import ( // - A unix socket // - An HTTPS endpoint #Service: engine.#Service + +#Stream: engine.#Stream + +#Address: engine.#Address \ No newline at end of file diff --git a/stdlib/europa/dagger/engine/spec/engine/utils.cue b/stdlib/europa/dagger/utils.cue similarity index 96% rename from stdlib/europa/dagger/engine/spec/engine/utils.cue rename to stdlib/europa/dagger/utils.cue index 929c21bc..29adf65b 100644 --- a/stdlib/europa/dagger/engine/spec/engine/utils.cue +++ b/stdlib/europa/dagger/utils.cue @@ -1,4 +1,4 @@ -package engine +package dagger import ( "alpha.dagger.io/europa/dagger/engine/spec/engine" diff --git a/tests/plan/hello-europa/main.cue b/tests/plan/hello-europa/main.cue index 2e4b152f..4459013a 100644 --- a/tests/plan/hello-europa/main.cue +++ b/tests/plan/hello-europa/main.cue @@ -1,11 +1,11 @@ package main import ( - "alpha.dagger.io/europa/dagger" + "alpha.dagger.io/europa/dagger/engine" "alpha.dagger.io/os" ) -dagger.#Plan & { +engine.#Plan & { actions: { sayHello: os.#Container & { command: "echo Hello Europa! > /out.txt" From 07862714afce242a8ca0f72e0e28ce1843f27e57 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 11:45:26 -0700 Subject: [PATCH 16/22] cue fmt Signed-off-by: Richard Jones --- stdlib/europa/dagger/types.cue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/europa/dagger/types.cue b/stdlib/europa/dagger/types.cue index 14740b6c..b08dbeab 100644 --- a/stdlib/europa/dagger/types.cue +++ b/stdlib/europa/dagger/types.cue @@ -28,4 +28,4 @@ import ( #Stream: engine.#Stream -#Address: engine.#Address \ No newline at end of file +#Address: engine.#Address From 7a4ed586d74fd862a5efeae7bec7e4d446b23f8e Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 11:55:28 -0700 Subject: [PATCH 17/22] added back comments to satisfy docs Signed-off-by: Richard Jones --- docs/reference/README.md | 6 ++-- docs/reference/europa/dagger/README.md | 4 +-- docs/reference/europa/dagger/engine/README.md | 34 ------------------- .../europa/dagger/engine/spec/engine.md | 24 +++++++------ stdlib/europa/dagger/plan.cue | 4 +++ stdlib/europa/dagger/types.cue | 2 ++ 6 files changed, 25 insertions(+), 49 deletions(-) diff --git a/docs/reference/README.md b/docs/reference/README.md index b4b2aed8..39209ca1 100644 --- a/docs/reference/README.md +++ b/docs/reference/README.md @@ -19,10 +19,12 @@ - [dagger/op](./dagger/op.md) - op: low-level operations for Dagger processing pipelines - [docker](./docker/README.md) - Docker container operations - [docker/compose](./docker/compose.md) - Docker-compose operations -- [europa/dagger](./europa/dagger/README.md) - The Dagger API. +- [europa/dagger](./europa/dagger/README.md) - - - [europa/dagger/engine](./europa/dagger/engine/README.md) - - - [europa/dagger/engine/spec](./europa/dagger/engine/spec/README.md) - Placeholder package, to keep docs generating tool happy. -- [europa/dagger/engine/spec/engine](./europa/dagger/engine/spec/engine.md) - HTTP operations +- [europa/dagger/engine/spec/engine](./europa/dagger/engine/spec/engine.md) - The Dagger API. + +HTTP operations - [gcp](./gcp/README.md) - Google Cloud Platform - [gcp/cloudrun](./gcp/cloudrun.md) - - - [gcp/gcr](./gcp/gcr.md) - Google Container Registry diff --git a/docs/reference/europa/dagger/README.md b/docs/reference/europa/dagger/README.md index 82a37e3a..dbec7284 100644 --- a/docs/reference/europa/dagger/README.md +++ b/docs/reference/europa/dagger/README.md @@ -4,8 +4,6 @@ sidebar_label: dagger # alpha.dagger.io/europa/dagger -The Dagger API. - ```cue import "alpha.dagger.io/europa/dagger" ``` @@ -72,7 +70,7 @@ _No output._ ## dagger.#Stream -A reference to a stream of bytes, for example: - The standard output or error stream of a command - The standard input stream of a command - The contents of a file or named pipe +A stream of bytes ### dagger.#Stream Inputs diff --git a/docs/reference/europa/dagger/engine/README.md b/docs/reference/europa/dagger/engine/README.md index efa36fc0..29ecb74f 100644 --- a/docs/reference/europa/dagger/engine/README.md +++ b/docs/reference/europa/dagger/engine/README.md @@ -8,40 +8,6 @@ sidebar_label: engine import "alpha.dagger.io/europa/dagger/engine" ``` -## engine.#CacheDir - -A (best effort) persistent cache dir - -### engine.#CacheDir Inputs - -_No input._ - -### engine.#CacheDir Outputs - -_No output._ - -## engine.#Context - -### engine.#Context Inputs - -_No input._ - -### engine.#Context Outputs - -_No output._ - -## engine.#Exec - -Execute a command in a container - -### engine.#Exec Inputs - -_No input._ - -### engine.#Exec Outputs - -_No output._ - ## engine.#FS A reference to a filesystem tree. For example: - The root filesystem of a container - A source code repository - A directory containing binary artifacts Rule of thumb: if it fits in a tar archive, it fits in a #FS. diff --git a/docs/reference/europa/dagger/engine/spec/engine.md b/docs/reference/europa/dagger/engine/spec/engine.md index a29168e8..676c6366 100644 --- a/docs/reference/europa/dagger/engine/spec/engine.md +++ b/docs/reference/europa/dagger/engine/spec/engine.md @@ -4,6 +4,8 @@ sidebar_label: engine # alpha.dagger.io/europa/dagger/engine/spec/engine +The Dagger API. + HTTP operations ```cue @@ -34,16 +36,6 @@ _No input._ _No output._ -## engine.#Context - -### engine.#Context Inputs - -_No input._ - -### engine.#Context Outputs - -_No output._ - ## engine.#Copy ### engine.#Copy Inputs @@ -64,6 +56,18 @@ _No input._ _No output._ +## engine.#DAG + +A special kind of program which `dagger` can execute. + +### engine.#DAG Inputs + +_No input._ + +### engine.#DAG Outputs + +_No output._ + ## engine.#Exec Execute a command in a container diff --git a/stdlib/europa/dagger/plan.cue b/stdlib/europa/dagger/plan.cue index 223f6cd2..891174ea 100644 --- a/stdlib/europa/dagger/plan.cue +++ b/stdlib/europa/dagger/plan.cue @@ -4,4 +4,8 @@ import ( "alpha.dagger.io/europa/dagger/engine/spec/engine" ) +// A deployment plan executed by `dagger up` #Plan: engine.#Plan + +// A special kind of program which `dagger` can execute. +#DAG: engine.#DAG diff --git a/stdlib/europa/dagger/types.cue b/stdlib/europa/dagger/types.cue index b08dbeab..adf1cd32 100644 --- a/stdlib/europa/dagger/types.cue +++ b/stdlib/europa/dagger/types.cue @@ -26,6 +26,8 @@ import ( // - An HTTPS endpoint #Service: engine.#Service +// A stream of bytes #Stream: engine.#Stream +// A network service address #Address: engine.#Address From cd9178fec99f8046eeb621d36ddbbad505d5449a Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 12:07:17 -0700 Subject: [PATCH 18/22] docs Signed-off-by: Richard Jones --- docs/reference/europa/dagger/engine/README.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/reference/europa/dagger/engine/README.md b/docs/reference/europa/dagger/engine/README.md index 29ecb74f..e77befb8 100644 --- a/docs/reference/europa/dagger/engine/README.md +++ b/docs/reference/europa/dagger/engine/README.md @@ -8,6 +8,30 @@ sidebar_label: engine import "alpha.dagger.io/europa/dagger/engine" ``` +## engine.#CacheDir + +A (best effort) persistent cache dir + +### engine.#CacheDir Inputs + +_No input._ + +### engine.#CacheDir Outputs + +_No output._ + +## engine.#Exec + +Execute a command in a container + +### engine.#Exec Inputs + +_No input._ + +### engine.#Exec Outputs + +_No output._ + ## engine.#FS A reference to a filesystem tree. For example: - The root filesystem of a container - A source code repository - A directory containing binary artifacts Rule of thumb: if it fits in a tar archive, it fits in a #FS. From 009a44ab27b191f4a0a20d23c330a3f12aa13ddf Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 12:15:05 -0700 Subject: [PATCH 19/22] context to inputs Signed-off-by: Richard Jones --- tests/tasks/exec/mount_secret.cue | 6 +++--- tests/tasks/exec/mount_service.cue | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/tasks/exec/mount_secret.cue b/tests/tasks/exec/mount_secret.cue index 74bb04ef..96d38edb 100644 --- a/tests/tasks/exec/mount_secret.cue +++ b/tests/tasks/exec/mount_secret.cue @@ -5,7 +5,7 @@ import ( ) engine.#Plan & { - context: secrets: testSecret: envvar: "TESTSECRET" + inputs: secrets: testSecret: envvar: "TESTSECRET" actions: { image: engine.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" @@ -15,7 +15,7 @@ engine.#Plan & { input: image.output mounts: secret: { dest: "/run/secrets/test" - contents: context.secrets.testSecret.contents + contents: inputs.secrets.testSecret.contents } args: [ "sh", "-c", @@ -30,7 +30,7 @@ engine.#Plan & { input: image.output mounts: secret: { dest: "/run/secrets/test" - contents: context.secrets.testSecret.contents + contents: inputs.secrets.testSecret.contents uid: 42 gid: 24 mask: 0o666 diff --git a/tests/tasks/exec/mount_service.cue b/tests/tasks/exec/mount_service.cue index 2073b6e9..a3b03460 100644 --- a/tests/tasks/exec/mount_service.cue +++ b/tests/tasks/exec/mount_service.cue @@ -5,7 +5,7 @@ import ( ) engine.#Plan & { - context: services: dockerSocket: unix: "/var/run/docker.sock" + proxy: dockerSocket: unix: "/var/run/docker.sock" actions: { image: engine.#Pull & { @@ -21,7 +21,7 @@ engine.#Plan & { input: imageWithDocker.output mounts: docker: { dest: "/var/run/docker.sock" - contents: context.services.dockerSocket.service + contents: proxy.dockerSocket.service } args: ["docker", "info"] } From 3ca5bbec0e95e873e7f7b81c2f25339a726d2d4f Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 12:22:34 -0700 Subject: [PATCH 20/22] fixed docs Signed-off-by: Richard Jones --- docs/reference/README.md | 2 -- docs/reference/europa/dagger/engine/spec/engine.md | 2 -- 2 files changed, 4 deletions(-) diff --git a/docs/reference/README.md b/docs/reference/README.md index 39209ca1..ef1dc42e 100644 --- a/docs/reference/README.md +++ b/docs/reference/README.md @@ -23,8 +23,6 @@ - [europa/dagger/engine](./europa/dagger/engine/README.md) - - - [europa/dagger/engine/spec](./europa/dagger/engine/spec/README.md) - Placeholder package, to keep docs generating tool happy. - [europa/dagger/engine/spec/engine](./europa/dagger/engine/spec/engine.md) - The Dagger API. - -HTTP operations - [gcp](./gcp/README.md) - Google Cloud Platform - [gcp/cloudrun](./gcp/cloudrun.md) - - - [gcp/gcr](./gcp/gcr.md) - Google Container Registry diff --git a/docs/reference/europa/dagger/engine/spec/engine.md b/docs/reference/europa/dagger/engine/spec/engine.md index 676c6366..d4fe0d8f 100644 --- a/docs/reference/europa/dagger/engine/spec/engine.md +++ b/docs/reference/europa/dagger/engine/spec/engine.md @@ -6,8 +6,6 @@ sidebar_label: engine The Dagger API. -HTTP operations - ```cue import "alpha.dagger.io/europa/dagger/engine/spec/engine" ``` From 1b49a47369c1f6620fc692b4a2c38b2173e33543 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 12:22:48 -0700 Subject: [PATCH 21/22] fixed docs Signed-off-by: Richard Jones --- stdlib/europa/dagger/engine/spec/engine/http.cue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/europa/dagger/engine/spec/engine/http.cue b/stdlib/europa/dagger/engine/spec/engine/http.cue index 3ff794bd..f6adb948 100644 --- a/stdlib/europa/dagger/engine/spec/engine/http.cue +++ b/stdlib/europa/dagger/engine/spec/engine/http.cue @@ -1,6 +1,7 @@ -// HTTP operations package engine +// HTTP operations + // Raw buildkit API // // package llb // import "github.com/moby/buildkit/client/llb" From 9426e6c13e32bf1f5ec869950f271ab0be6af31a Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 17 Dec 2021 12:32:49 -0700 Subject: [PATCH 22/22] fixed pull_auth test Signed-off-by: Richard Jones --- tests/tasks/pull/pull_auth.cue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tasks/pull/pull_auth.cue b/tests/tasks/pull/pull_auth.cue index f821f74d..d11ab2dc 100644 --- a/tests/tasks/pull/pull_auth.cue +++ b/tests/tasks/pull/pull_auth.cue @@ -5,13 +5,13 @@ import ( ) engine.#Plan & { - context: secrets: dockerHubToken: envvar: "DOCKERHUB_TOKEN" + inputs: secrets: dockerHubToken: envvar: "DOCKERHUB_TOKEN" actions: pull: engine.#Pull & { source: "daggerio/ci-test:private-pull@sha256:c74f1b1166784193ea6c8f9440263b9be6cae07dfe35e32a5df7a31358ac2060" auth: [{ target: "daggerio/ci-test:private-pull" username: "daggertest" - secret: context.secrets.dockerHubToken.contents + secret: inputs.secrets.dockerHubToken.contents }] } & { // assert result