diff --git a/ci/main.cue b/ci/main.cue index 798f5ccc..6abdcaa0 100644 --- a/ci/main.cue +++ b/ci/main.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/bash" ) @@ -19,7 +20,7 @@ dagger.#Plan & { _mountGoCache: { mounts: "go mod cache": { dest: "/root/.gocache" - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { id: "go mod cache" } } diff --git a/docs/tests/core-concepts/container-images/simple/with-dockerfile.cue b/docs/tests/core-concepts/container-images/simple/with-dockerfile.cue index ec9849af..3361087d 100644 --- a/docs/tests/core-concepts/container-images/simple/with-dockerfile.cue +++ b/docs/tests/core-concepts/container-images/simple/with-dockerfile.cue @@ -2,12 +2,13 @@ package main import ( "dagger.io/dagger" + "universe.dagger.io/docker" ) dagger.#Plan & { client: filesystem: "./src": read: contents: dagger.#FS - actions: build: dagger.#Dockerfile & { + actions: build: docker.#Dockerfile & { // This is the context. source: client.filesystem."./src".read.contents diff --git a/docs/tests/core-concepts/plan/structure.cue.fragment b/docs/tests/core-concepts/plan/structure.cue.fragment index 2e840774..67e2d227 100644 --- a/docs/tests/core-concepts/plan/structure.cue.fragment +++ b/docs/tests/core-concepts/plan/structure.cue.fragment @@ -23,7 +23,7 @@ dagger.#Plan & { run: bash.#Run & { // ... } - contents: dagger.#Subdir & { + contents: core.#Subdir & { // ... } } diff --git a/docs/tests/core-concepts/secrets/plans/file.cue b/docs/tests/core-concepts/secrets/plans/file.cue index 6807cce4..3e55af6c 100644 --- a/docs/tests/core-concepts/secrets/plans/file.cue +++ b/docs/tests/core-concepts/secrets/plans/file.cue @@ -5,7 +5,7 @@ dagger.#Plan & { contents: dagger.#Secret } actions: { - registry: dagger.#TrimSecret & { + registry: core.#TrimSecret & { input: client.filesystem.".registry".read.contents } pull: docker.#Pull & { diff --git a/docs/tests/core-concepts/secrets/plans/sops.cue b/docs/tests/core-concepts/secrets/plans/sops.cue index 7afeee45..a021baea 100644 --- a/docs/tests/core-concepts/secrets/plans/sops.cue +++ b/docs/tests/core-concepts/secrets/plans/sops.cue @@ -7,7 +7,7 @@ dagger.#Plan & { actions: { // Makes the yaml keys easily accessible - secrets: dagger.#DecodeSecret & { + secrets: core.#DecodeSecret & { input: client.commands.sops.stdout format: "yaml" } diff --git a/docs/use-cases/1211-go-docker-swarm.md b/docs/use-cases/1211-go-docker-swarm.md index 66c59838..116ccf18 100644 --- a/docs/use-cases/1211-go-docker-swarm.md +++ b/docs/use-cases/1211-go-docker-swarm.md @@ -28,6 +28,7 @@ package particubes import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) @@ -63,7 +64,7 @@ dagger.#Plan & { image: build.output } - docsSecrets: dagger.#DecodeSecret & { + docsSecrets: core.#DecodeSecret & { input: inputs.secrets.docs.contents format: "yaml" } diff --git a/pkg/dagger.io/dagger/exec.cue b/pkg/dagger.io/dagger/core/exec.cue similarity index 88% rename from pkg/dagger.io/dagger/exec.cue rename to pkg/dagger.io/dagger/core/exec.cue index ed3540e3..3bcdfc3d 100644 --- a/pkg/dagger.io/dagger/exec.cue +++ b/pkg/dagger.io/dagger/core/exec.cue @@ -1,11 +1,13 @@ -package dagger +package core + +import "dagger.io/dagger" // Execute a command in a container #Exec: { $dagger: task: _name: "Exec" // Container filesystem - input: #FS + input: dagger.#FS // Transient filesystem mounts // Key is an arbitrary name, for example "app source code" @@ -17,7 +19,7 @@ package dagger args: [...string] // Environment variables - env: [key=string]: string | #Secret + env: [key=string]: string | dagger.#Secret // Working directory workdir: string | *"/" @@ -33,7 +35,7 @@ package dagger hosts: [hostname=string]: string // Modified filesystem - output: #FS + output: dagger.#FS // Command exit code // Currently this field can only ever be zero. @@ -54,15 +56,15 @@ package dagger contents: #TempDir } | { type: "service" - contents: #Service + contents: dagger.#Service } | { type: "fs" - contents: #FS + contents: dagger.#FS source?: string ro?: true | *false } | { type: "secret" - contents: #Secret + contents: dagger.#Secret uid: int | *0 gid: int | *0 mask: int | *0o400 diff --git a/pkg/dagger.io/dagger/fs.cue b/pkg/dagger.io/dagger/core/fs.cue similarity index 82% rename from pkg/dagger.io/dagger/fs.cue rename to pkg/dagger.io/dagger/core/fs.cue index 7840681c..77efee8c 100644 --- a/pkg/dagger.io/dagger/fs.cue +++ b/pkg/dagger.io/dagger/core/fs.cue @@ -1,4 +1,6 @@ -package dagger +package core + +import "dagger.io/dagger" // Access the source directory for the current CUE package // This may safely be called from any package @@ -12,7 +14,7 @@ package dagger // Optionally include certain files exclude: [...string] - output: #FS + output: dagger.#FS } // Create one or multiple directory in a container @@ -20,7 +22,7 @@ package dagger $dagger: task: _name: "Mkdir" // Container filesystem - input: #FS + input: dagger.#FS // Path of the directory to create // It can be nested (e.g : "/foo" or "/foo/bar") @@ -33,14 +35,14 @@ package dagger parents: *true | false // Modified filesystem - output: #FS + output: dagger.#FS } #ReadFile: { $dagger: task: _name: "ReadFile" // Filesystem tree holding the file - input: #FS + input: dagger.#FS // Path of the file to read path: string // Contents of the file @@ -52,7 +54,7 @@ package dagger $dagger: task: _name: "WriteFile" // Input filesystem tree - input: #FS + input: dagger.#FS // Path of the file to write path: string // Contents to write @@ -60,27 +62,27 @@ package dagger // Permissions of the file permissions: *0o600 | int // Output filesystem tree - output: #FS + output: dagger.#FS } // Copy files from one FS tree to another #Copy: { $dagger: task: _name: "Copy" // Input of the operation - input: #FS + input: dagger.#FS // Contents to copy - contents: #FS + contents: dagger.#FS // Source path (optional) source: string | *"/" // Destination path (optional) dest: string | *"/" // Output of the operation - output: #FS + output: dagger.#FS } #CopyInfo: { source: { - root: #FS + root: dagger.#FS path: string | *"/" } dest: string @@ -89,22 +91,22 @@ package dagger // Merge multiple FS trees into one #Merge: { $dagger: task: _name: "Merge" - inputs: [...#FS] - output: #FS + inputs: [...dagger.#FS] + output: dagger.#FS } // Extract the difference from lower FS to upper FS as its own FS #Diff: { $dagger: task: _name: "Diff" - lower: #FS - upper: #FS - output: #FS + lower: dagger.#FS + upper: dagger.#FS + output: dagger.#FS } // Select a subdirectory from a filesystem tree #Subdir: { // Input tree - input: #FS + input: dagger.#FS // Path of the subdirectory // Example: "/build" @@ -112,12 +114,12 @@ package dagger // Copy action _copy: #Copy & { - "input": #Scratch + "input": dagger.#Scratch contents: input source: path dest: "/" } // Subdirectory tree - output: #FS & _copy.output + output: dagger.#FS & _copy.output } diff --git a/pkg/dagger.io/dagger/git.cue b/pkg/dagger.io/dagger/core/git.cue similarity index 68% rename from pkg/dagger.io/dagger/git.cue rename to pkg/dagger.io/dagger/core/git.cue index 28448f7d..d07017ed 100644 --- a/pkg/dagger.io/dagger/git.cue +++ b/pkg/dagger.io/dagger/core/git.cue @@ -1,17 +1,19 @@ -package dagger +package core + +import "dagger.io/dagger" // Push a directory to a git remote #GitPush: { @dagger(notimplemented) $dagger: task: _name: "GitPush" - input: #FS + input: dagger.#FS remote: string ref: string } // Pull a directory from a git remote -// Warning: do NOT embed credentials in the remote url as this will expose them in logs. +// Warning: do NOT embed credentials in the remote url as this will expose them in logs. // By using username and password Dagger will handle this for you in a secure manner. #GitPull: { $dagger: task: _name: "GitPull" @@ -20,11 +22,11 @@ package dagger keepGitDir: true | *false auth?: { username: string - password: #Secret // can be password or personal access token + password: dagger.#Secret // can be password or personal access token } | { - authToken: #Secret + authToken: dagger.#Secret } | { - authHeader: #Secret + authHeader: dagger.#Secret } - output: #FS + output: dagger.#FS } diff --git a/pkg/dagger.io/dagger/http.cue b/pkg/dagger.io/dagger/core/http.cue similarity index 94% rename from pkg/dagger.io/dagger/http.cue rename to pkg/dagger.io/dagger/core/http.cue index 1cb52b88..fc3958e7 100644 --- a/pkg/dagger.io/dagger/http.cue +++ b/pkg/dagger.io/dagger/core/http.cue @@ -1,4 +1,4 @@ -package dagger +package core // HTTP operations @@ -16,6 +16,8 @@ package dagger // func Chown(uid, gid int) HTTPOption // func Filename(name string) HTTPOption +import "dagger.io/dagger" + // Fetch a file over HTTP #HTTPFetch: { $dagger: task: _name: "HTTPFetch" @@ -43,5 +45,5 @@ package dagger gid?: int // New filesystem state containing the downloaded file - output: #FS + output: dagger.#FS } diff --git a/pkg/dagger.io/dagger/core/image.cue b/pkg/dagger.io/dagger/core/image.cue new file mode 100644 index 00000000..345be094 --- /dev/null +++ b/pkg/dagger.io/dagger/core/image.cue @@ -0,0 +1,182 @@ +package core + +import ( + "list" + "dagger.io/dagger" +) + +// Upload a container image to a remote repository +#Push: { + $dagger: task: _name: "Push" + + // Target repository address + dest: dagger.#Ref + + // Filesystem contents to push + input: dagger.#FS + + // Container image config + config: dagger.#ImageConfig + + // Authentication + auth?: { + username: string + secret: dagger.#Secret + } + + // Complete ref of the pushed image, including digest + result: dagger.#Ref +} + +// Download a container image from a remote repository +#Pull: { + $dagger: task: _name: "Pull" + + // Repository source ref + source: dagger.#Ref + + // Authentication + auth?: { + username: string + secret: dagger.#Secret + } + + // Root filesystem of downloaded image + output: dagger.#FS + + // Image digest + digest: string + + // Downloaded container image config + config: dagger.#ImageConfig +} + +// Build a container image using a Dockerfile +#Dockerfile: { + $dagger: task: _name: "Dockerfile" + + // Source directory to build + source: dagger.#FS + + dockerfile: *{ + path: string | *"Dockerfile" + } | { + contents: string + } + + // Authentication + auth: [registry=string]: { + username: string + secret: dagger.#Secret + } + + platforms?: [...string] + target?: string + buildArg?: [string]: string + label?: [string]: string + hosts?: [string]: string + + // Root filesystem produced + output: dagger.#FS + + // Container image config produced + config: dagger.#ImageConfig +} + +// Export an image as a tar archive +#Export: { + $dagger: task: _name: "Export" + + // Filesystem contents to export + input: dagger.#FS + + // Container image config + config: dagger.#ImageConfig + + // Name and optionally a tag in the 'name:tag' format + tag: string + + // Type of export + type: *"docker" | "oci" + + // Path to the exported file inside `output` + path: string | *"/image.tar" + + // Exported image ID + imageID: string + + // Root filesystem with exported file + output: dagger.#FS +} + +// Change image config +#Set: { + // The source image config + input: dagger.#ImageConfig + + // The config to merge + config: dagger.#ImageConfig + + // Resulting config + output: dagger.#ImageConfig & { + let structs = ["env", "label", "volume", "expose"] + let lists = ["onbuild"] + + // doesn't exist in config, copy away + for field, value in input if config[field] == _|_ { + "\(field)": value + } + + // only exists in config, just copy as is + for field, value in config if input[field] == _|_ { + "\(field)": value + } + + // these should exist in both places + for field, value in config if input[field] != _|_ { + "\(field)": { + // handle structs that need merging + if list.Contains(structs, field) { + _#mergeStructs & { + #a: input[field] + #b: config[field] + } + } + + // handle lists that need concatenation + if list.Contains(lists, field) { + list.Concat([ + input[field], + config[field], + ]) + } + + // replace anything else + if !list.Contains(structs+lists, field) { + value + } + } + } + } +} + +// Merge two structs by overwriting or adding values +_#mergeStructs: { + // Struct with defaults + #a: [string]: _ + + // Struct with overrides + #b: [string]: _ + { + // FIXME: we need exists() in if because this matches any kind of error (cue-lang/cue#943) + // add anything not in b + for field, value in #a if #b[field] == _|_ { + "\(field)": value + } + + // safely add all of b + for field, value in #b { + "\(field)": value + } + } +} diff --git a/pkg/dagger.io/dagger/nop.cue b/pkg/dagger.io/dagger/core/nop.cue similarity index 93% rename from pkg/dagger.io/dagger/nop.cue rename to pkg/dagger.io/dagger/core/nop.cue index 4e1d2580..63a5a9c7 100644 --- a/pkg/dagger.io/dagger/nop.cue +++ b/pkg/dagger.io/dagger/core/nop.cue @@ -1,4 +1,4 @@ -package dagger +package core // A core action that does nothing // Useful to work around bugs in the DAG resolver. diff --git a/pkg/dagger.io/dagger/secrets.cue b/pkg/dagger.io/dagger/core/secrets.cue similarity index 73% rename from pkg/dagger.io/dagger/secrets.cue rename to pkg/dagger.io/dagger/core/secrets.cue index 07b2b99c..623cca83 100644 --- a/pkg/dagger.io/dagger/secrets.cue +++ b/pkg/dagger.io/dagger/core/secrets.cue @@ -1,17 +1,19 @@ -package dagger +package core + +import "dagger.io/dagger" // Decode the contents of a secrets without leaking it. // Supported formats: json, yaml #DecodeSecret: { $dagger: task: _name: "DecodeSecret" - // A #Secret whose plain text is a JSON or YAML string - input: #Secret + // A dagger.#Secret whose plain text is a JSON or YAML string + input: dagger.#Secret format: "json" | "yaml" // A new secret or (map of secrets) derived from unmarshaling the input secret's plain text - output: #Secret | {[string]: output} + output: dagger.#Secret | {[string]: output} } // Create a new a secret from a filesystem tree @@ -19,13 +21,13 @@ package dagger $dagger: task: _name: "NewSecret" // Filesystem tree holding the secret - input: #FS + input: dagger.#FS // Path of the secret to read path: string // Whether to trim leading and trailing space characters from secret value trimSpace: *true | false // Contents of the secret - output: #Secret + output: dagger.#Secret } // Trim leading and trailing space characters from a secret @@ -33,8 +35,8 @@ package dagger $dagger: task: _name: "TrimSecret" // Original secret - input: #Secret + input: dagger.#Secret // New trimmed secret - output: #Secret + output: dagger.#Secret } diff --git a/pkg/dagger.io/dagger/image.cue b/pkg/dagger.io/dagger/image.cue index 6068f63d..66a6e508 100644 --- a/pkg/dagger.io/dagger/image.cue +++ b/pkg/dagger.io/dagger/image.cue @@ -1,32 +1,5 @@ package dagger -import ( - "list" -) - -// Upload a container image to a remote repository -#Push: { - $dagger: task: _name: "Push" - - // Target repository address - dest: #Ref - - // Filesystem contents to push - input: #FS - - // Container image config - config: #ImageConfig - - // Authentication - auth?: { - username: string - secret: #Secret - } - - // Complete ref of the pushed image, including digest - result: #Ref -} - // A ref is an address for a remote container image // // Examples: @@ -61,156 +34,3 @@ import ( startperiod?: int retries?: int } - -// Download a container image from a remote repository -#Pull: { - $dagger: task: _name: "Pull" - - // Repository source ref - source: #Ref - - // Authentication - auth?: { - username: string - secret: #Secret - } - - // Root filesystem of downloaded image - output: #FS - - // Image digest - digest: string - - // Downloaded container image config - config: #ImageConfig -} - -// Build a container image using a Dockerfile -#Dockerfile: { - $dagger: task: _name: "Dockerfile" - - // Source directory to build - source: #FS - - dockerfile: *{ - path: string | *"Dockerfile" - } | { - contents: string - } - - // Authentication - auth: [registry=string]: { - username: string - secret: #Secret - } - - platforms?: [...string] - target?: string - buildArg?: [string]: string - label?: [string]: string - hosts?: [string]: string - - // Root filesystem produced - output: #FS - - // Container image config produced - config: #ImageConfig -} - -// Export an image as a tar archive -#Export: { - $dagger: task: _name: "Export" - - // Filesystem contents to export - input: #FS - - // Container image config - config: #ImageConfig - - // Name and optionally a tag in the 'name:tag' format - tag: string - - // Type of export - type: *"docker" | "oci" - - // Path to the exported file inside `output` - path: string | *"/image.tar" - - // Exported image ID - imageID: string - - // Root filesystem with exported file - output: #FS -} - -// Change image config -#Set: { - // The source image config - input: #ImageConfig - - // The config to merge - config: #ImageConfig - - // Resulting config - output: #ImageConfig & { - let structs = ["env", "label", "volume", "expose"] - let lists = ["onbuild"] - - // doesn't exist in config, copy away - for field, value in input if config[field] == _|_ { - "\(field)": value - } - - // only exists in config, just copy as is - for field, value in config if input[field] == _|_ { - "\(field)": value - } - - // these should exist in both places - for field, value in config if input[field] != _|_ { - "\(field)": { - // handle structs that need merging - if list.Contains(structs, field) { - _#mergeStructs & { - #a: input[field] - #b: config[field] - } - } - - // handle lists that need concatenation - if list.Contains(lists, field) { - list.Concat([ - input[field], - config[field], - ]) - } - - // replace anything else - if !list.Contains(structs+lists, field) { - value - } - } - } - } -} - -// Merge two structs by overwriting or adding values -_#mergeStructs: { - // Struct with defaults - #a: [string]: _ - - // Struct with overrides - #b: [string]: _ - { - // FIXME: we need exists() in if because this matches any kind of error (cue-lang/cue#943) - // add anything not in b - for field, value in #a if #b[field] == _|_ { - "\(field)": value - } - - // safely add all of b - for field, value in #b { - "\(field)": value - } - } -} diff --git a/pkg/pkg.go b/pkg/pkg.go index 221a7bfd..829f334b 100644 --- a/pkg/pkg.go +++ b/pkg/pkg.go @@ -31,7 +31,8 @@ var ( UniverseModule, } - DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule) + DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule) + DaggerCorePackage = fmt.Sprintf("%s/core", DaggerPackage) lockFilePath = "dagger.lock" ) diff --git a/pkg/universe.dagger.io/alpine/test/test.cue b/pkg/universe.dagger.io/alpine/test/test.cue index 1c99cab2..1bfb7bd7 100644 --- a/pkg/universe.dagger.io/alpine/test/test.cue +++ b/pkg/universe.dagger.io/alpine/test/test.cue @@ -2,6 +2,7 @@ package alpine import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/alpine" "universe.dagger.io/docker" @@ -16,7 +17,7 @@ dagger.#Plan & { version: "3.10.9" } - verify: dagger.#Readfile & { + verify: core.#ReadFile & { input: build.output.rootfs path: "/etc/alpine-release" contents: "3.10.9\n" diff --git a/pkg/universe.dagger.io/aws/aws.cue b/pkg/universe.dagger.io/aws/aws.cue index 7024cf66..d16bbbab 100644 --- a/pkg/universe.dagger.io/aws/aws.cue +++ b/pkg/universe.dagger.io/aws/aws.cue @@ -3,13 +3,14 @@ package aws import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) #DefaultLinuxVersion: "amazonlinux:2.0.20220121.0@sha256:f3a37f84f2644095e2c6f6fdf2bf4dbf68d5436c51afcfbfa747a5de391d5d62" #DefaultCliVersion: "2.4.12" -// Build provides a docker.#Image with the aws cli pre-installed to Amazon Linux 2. +// Build provides a docker.#Image with the aws cli pre-installed to Amazon Linux 2. // Can be customized with packages, and can be used with docker.#Run for executing custom scripts. // Used by default with aws.#Run #Build: { @@ -39,7 +40,7 @@ import ( ] } - _scripts: dagger.#Source & { + _scripts: core.#Source & { path: "_scripts" } diff --git a/pkg/universe.dagger.io/aws/cli/test/sts_get_caller_identity.cue b/pkg/universe.dagger.io/aws/cli/test/sts_get_caller_identity.cue index a5111a02..b167ed5a 100644 --- a/pkg/universe.dagger.io/aws/cli/test/sts_get_caller_identity.cue +++ b/pkg/universe.dagger.io/aws/cli/test/sts_get_caller_identity.cue @@ -2,6 +2,7 @@ package test import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/aws" "universe.dagger.io/aws/cli" ) @@ -14,7 +15,7 @@ dagger.#Plan & { } actions: { - sopsSecrets: dagger.#DecodeSecret & { + sopsSecrets: core.#DecodeSecret & { format: "yaml" input: client.commands.sops.stdout } diff --git a/pkg/universe.dagger.io/aws/test/config_file.cue b/pkg/universe.dagger.io/aws/test/config_file.cue index c8c9b9b6..a6c028a1 100644 --- a/pkg/universe.dagger.io/aws/test/config_file.cue +++ b/pkg/universe.dagger.io/aws/test/config_file.cue @@ -3,6 +3,7 @@ package test import ( "encoding/json" "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/aws" ) @@ -20,7 +21,7 @@ dagger.#Plan & { } actions: { - sopsSecrets: dagger.#DecodeSecret & { + sopsSecrets: core.#DecodeSecret & { format: "yaml" input: client.commands.sops.stdout } diff --git a/pkg/universe.dagger.io/aws/test/credentials.cue b/pkg/universe.dagger.io/aws/test/credentials.cue index c12e91c7..c7b75acd 100644 --- a/pkg/universe.dagger.io/aws/test/credentials.cue +++ b/pkg/universe.dagger.io/aws/test/credentials.cue @@ -3,6 +3,7 @@ package test import ( "encoding/json" "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/aws" ) @@ -14,7 +15,7 @@ dagger.#Plan & { } actions: { - sopsSecrets: dagger.#DecodeSecret & { + sopsSecrets: core.#DecodeSecret & { format: "yaml" input: client.commands.sops.stdout } diff --git a/pkg/universe.dagger.io/bash/bash.cue b/pkg/universe.dagger.io/bash/bash.cue index 117195b2..6ca5ec9d 100644 --- a/pkg/universe.dagger.io/bash/bash.cue +++ b/pkg/universe.dagger.io/bash/bash.cue @@ -3,6 +3,7 @@ package bash import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) @@ -26,7 +27,7 @@ import ( contents: string _filename: "run.sh" - _write: dagger.#WriteFile & { + _write: core.#WriteFile & { input: dagger.#Scratch path: _filename "contents": contents diff --git a/pkg/universe.dagger.io/bash/test/test.cue b/pkg/universe.dagger.io/bash/test/test.cue index 0620f8a0..252d55c6 100644 --- a/pkg/universe.dagger.io/bash/test/test.cue +++ b/pkg/universe.dagger.io/bash/test/test.cue @@ -2,6 +2,7 @@ package bash import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" "universe.dagger.io/bash" @@ -19,7 +20,7 @@ dagger.#Plan & { runFile: { dir: _load.output - _load: dagger.#Source & { + _load: core.#Source & { path: "./data" include: ["*.sh"] } diff --git a/pkg/universe.dagger.io/docker/build.cue b/pkg/universe.dagger.io/docker/build.cue index 162315af..d578e79e 100644 --- a/pkg/universe.dagger.io/docker/build.cue +++ b/pkg/universe.dagger.io/docker/build.cue @@ -2,6 +2,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) // Modular build API for Docker containers @@ -46,7 +47,7 @@ import ( dest: string | *"/" // Execute copy operation - _copy: dagger.#Copy & { + _copy: core.#Copy & { "input": input.rootfs "contents": contents "source": source @@ -83,7 +84,7 @@ import ( label: [string]: string hosts: [string]: string - _build: dagger.#Dockerfile & { + _build: core.#Dockerfile & { "source": source "auth": auth "dockerfile": dockerfile diff --git a/pkg/universe.dagger.io/docker/cli/load.cue b/pkg/universe.dagger.io/docker/cli/load.cue index 27af165a..360a8e60 100644 --- a/pkg/universe.dagger.io/docker/cli/load.cue +++ b/pkg/universe.dagger.io/docker/cli/load.cue @@ -1,7 +1,7 @@ package cli import ( - "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) @@ -19,7 +19,7 @@ import ( // Root filesystem with exported file result: _export.output - _export: dagger.#Export & { + _export: core.#Export & { "tag": tag input: image.rootfs config: image.config diff --git a/pkg/universe.dagger.io/docker/pull.cue b/pkg/universe.dagger.io/docker/pull.cue index 83044700..bca9315b 100644 --- a/pkg/universe.dagger.io/docker/pull.cue +++ b/pkg/universe.dagger.io/docker/pull.cue @@ -3,6 +3,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) // Download an image from a remote registry @@ -16,7 +17,7 @@ import ( secret: dagger.#Secret } - _op: dagger.#Pull & { + _op: core.#Pull & { "source": source if auth != _|_ { "auth": auth diff --git a/pkg/universe.dagger.io/docker/push.cue b/pkg/universe.dagger.io/docker/push.cue index a8076a72..532d1db5 100644 --- a/pkg/universe.dagger.io/docker/push.cue +++ b/pkg/universe.dagger.io/docker/push.cue @@ -2,6 +2,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) // Upload an image to a remote repository @@ -21,7 +22,7 @@ import ( // Image to push image: #Image - _push: dagger.#Push & { + _push: core.#Push & { "dest": dest if auth != _|_ { "auth": auth diff --git a/pkg/universe.dagger.io/docker/run.cue b/pkg/universe.dagger.io/docker/run.cue index 0d4cf23b..a6723ab3 100644 --- a/pkg/universe.dagger.io/docker/run.cue +++ b/pkg/universe.dagger.io/docker/run.cue @@ -4,6 +4,7 @@ import ( "list" "dagger.io/dagger" + "dagger.io/dagger/core" ) // Run a command in a container @@ -14,7 +15,7 @@ import ( always: bool | *false // Filesystem mounts - mounts: [name=string]: dagger.#Mount + mounts: [name=string]: core.#Mount // Expose network ports // FIXME: investigate feasibility @@ -70,7 +71,7 @@ import ( // Add defaults to image config // This ensures these values are present - _defaults: dagger.#Set & { + _defaults: core.#Set & { "input": { entrypoint: [] cmd: [] @@ -81,7 +82,7 @@ import ( } // Override with user config - _config: dagger.#Set & { + _config: core.#Set & { input: _defaults.output config: { if entrypoint != _|_ { @@ -123,7 +124,7 @@ import ( for path, _ in files { "\(path)": { contents: string & _read.contents - _read: dagger.#ReadFile & { + _read: core.#ReadFile & { input: _exec.output "path": path } @@ -139,7 +140,7 @@ import ( for path, _ in directories { "\(path)": { contents: dagger.#FS & _subdir.output - _subdir: dagger.#Subdir & { + _subdir: core.#Subdir & { input: _exec.output "path": path } @@ -159,7 +160,7 @@ import ( } // Actually execute the command - _exec: dagger.#Exec & { + _exec: core.#Exec & { "input": input.rootfs "always": always "mounts": mounts @@ -167,7 +168,7 @@ import ( workdir: _config.output.workdir user: _config.output.user "env": env - // env may contain secrets so we can't use dagger.#Set + // env may contain secrets so we can't use core.#Set if input.config.env != _|_ { for key, val in input.config.env { if env[key] == _|_ { diff --git a/pkg/universe.dagger.io/docker/set.cue b/pkg/universe.dagger.io/docker/set.cue index 491d36fb..2f34a94f 100644 --- a/pkg/universe.dagger.io/docker/set.cue +++ b/pkg/universe.dagger.io/docker/set.cue @@ -2,6 +2,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) // Change image config @@ -12,7 +13,7 @@ import ( // The image config to change config: dagger.#ImageConfig - _set: dagger.#Set & { + _set: core.#Set & { "input": input.config "config": config } diff --git a/pkg/universe.dagger.io/docker/test/build.cue b/pkg/universe.dagger.io/docker/test/build.cue index 38da4da3..a49f2f21 100644 --- a/pkg/universe.dagger.io/docker/test/build.cue +++ b/pkg/universe.dagger.io/docker/test/build.cue @@ -2,6 +2,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/alpine" "universe.dagger.io/docker" @@ -26,7 +27,7 @@ dagger.#Plan & { ] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: image.output.rootfs path: "/test.txt" } @@ -59,7 +60,7 @@ dagger.#Plan & { ] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: image.output.rootfs path: "/test.txt" } diff --git a/pkg/universe.dagger.io/docker/test/dockerfile.cue b/pkg/universe.dagger.io/docker/test/dockerfile.cue index 259a86b2..771bd84e 100644 --- a/pkg/universe.dagger.io/docker/test/dockerfile.cue +++ b/pkg/universe.dagger.io/docker/test/dockerfile.cue @@ -2,6 +2,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) @@ -16,7 +17,7 @@ dagger.#Plan & { source: dagger.#Scratch dockerfile: contents: """ FROM alpine:3.15 - + RUN echo -n hello world >> /test.txt """ }, @@ -33,7 +34,7 @@ dagger.#Plan & { ] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: build.output.rootfs path: "/test.txt" } & { @@ -58,7 +59,7 @@ dagger.#Plan & { ] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: build.output.rootfs path: "/test.txt" } & { diff --git a/pkg/universe.dagger.io/docker/test/image.cue b/pkg/universe.dagger.io/docker/test/image.cue index 69c5f7a5..d009b854 100644 --- a/pkg/universe.dagger.io/docker/test/image.cue +++ b/pkg/universe.dagger.io/docker/test/image.cue @@ -2,6 +2,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) @@ -43,7 +44,7 @@ dagger.#Plan & { // Test: image config behavior is correct config: { - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: dagger.#Scratch dockerfile: contents: """ FROM alpine:3.15.0 @@ -71,7 +72,7 @@ dagger.#Plan & { contents: """ #!/bin/sh echo -n "hello from $HELLO_FROM" > /dagger.txt - + """ } } diff --git a/pkg/universe.dagger.io/docker/test/run.cue b/pkg/universe.dagger.io/docker/test/run.cue index 435d6d9e..bd973140 100644 --- a/pkg/universe.dagger.io/docker/test/run.cue +++ b/pkg/universe.dagger.io/docker/test/run.cue @@ -2,6 +2,7 @@ package docker import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" "universe.dagger.io/alpine" @@ -24,7 +25,7 @@ dagger.#Plan & { } } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: run.output.rootfs path: "/output.txt" } @@ -59,7 +60,7 @@ dagger.#Plan & { export: directories: "/test": _ } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: run.export.directories."/test" path: "/output.txt" } diff --git a/pkg/universe.dagger.io/examples/changelog.com/_prototypes/joel/main.cue b/pkg/universe.dagger.io/examples/changelog.com/_prototypes/joel/main.cue index a4148635..0e928c9f 100644 --- a/pkg/universe.dagger.io/examples/changelog.com/_prototypes/joel/main.cue +++ b/pkg/universe.dagger.io/examples/changelog.com/_prototypes/joel/main.cue @@ -56,11 +56,11 @@ dagger.#Plan & { } actions: { - runtimeImage: dagger.#Pull & { + runtimeImage: core.#Pull & { source: runtime_image_ref } - depsCache: dagger.#CacheDir & { + depsCache: core.#CacheDir & { id: "depsCache" } @@ -69,7 +69,7 @@ dagger.#Plan & { contents: depsCache } - buildCacheTest: dagger.#CacheDir & { + buildCacheTest: core.#CacheDir & { id: "buildCacheTest" } @@ -78,7 +78,7 @@ dagger.#Plan & { contents: buildCacheTest } - buildCacheProd: dagger.#CacheDir & { + buildCacheProd: core.#CacheDir & { id: "buildCacheProd" } @@ -87,7 +87,7 @@ dagger.#Plan & { contents: buildCacheProd } - nodeModulesCache: dagger.#CacheDir & { + nodeModulesCache: core.#CacheDir & { id: "nodeModulesCache" } @@ -96,20 +96,20 @@ dagger.#Plan & { contents: nodeModulesCache } - appImage: dagger.#Copy & { + appImage: core.#Copy & { input: runtimeImage.output contents: inputs.directories.app.contents dest: "/app" } - deps: dagger.#Exec & { + deps: core.#Exec & { input: appImage.output mounts: depsCacheMount workdir: "/app" args: ["bash", "-c", " mix deps.get"] } - assetsCompile: dagger.#Exec & { + assetsCompile: core.#Exec & { input: depsCompileProd.output mounts: depsCacheMount & nodeModulesCacheMount workdir: "/app/assets" @@ -117,7 +117,7 @@ dagger.#Plan & { args: ["bash", "-c", "yarn install --frozen-lockfile && yarn run compile"] } - #depsCompile: dagger.#Exec & { + #depsCompile: core.#Exec & { input: deps.output mounts: depsCacheMount workdir: "/app" @@ -134,7 +134,7 @@ dagger.#Plan & { mounts: buildCacheProdMount } - assetsDigest: dagger.#Exec & { + assetsDigest: core.#Exec & { input: assetsCompile.output mounts: depsCacheMount & buildCacheProdMount & nodeModulesCacheMount env: MIX_ENV: "prod" @@ -142,20 +142,20 @@ dagger.#Plan & { args: ["bash", "-c", "mix phx.digest"] } - imageProdCacheCopy: dagger.#Exec & { + imageProdCacheCopy: core.#Exec & { input: assetsDigest.output mounts: (depsCacheMount & {depsCache: dest: "/mnt/app/deps/"} ) mounts: (buildCacheProdMount & {buildCacheProd: dest: "/mnt/app/_build/prod"} ) args: ["bash", "-c", "cp -Rp /mnt/app/deps/* /app/deps/ && cp -Rp /mnt/app/_build/prod/* /app/_build/prod/"] } - imageProdDockerCopy: dagger.#Copy & { + imageProdDockerCopy: core.#Copy & { input: imageProdCacheCopy.output source: root: inputs.directories.docker.contents dest: "/" } - imageProd: dagger.#Build & { + imageProd: core.#Dockerfile & { source: imageProdDockerCopy.output dockerfile: path: "/docker/Dockerfile.production" buildArg: { diff --git a/pkg/universe.dagger.io/examples/changelog.com/commented.cue b/pkg/universe.dagger.io/examples/changelog.com/commented.cue index 5045e67a..0e4cb971 100644 --- a/pkg/universe.dagger.io/examples/changelog.com/commented.cue +++ b/pkg/universe.dagger.io/examples/changelog.com/commented.cue @@ -19,7 +19,7 @@ actions: { // workdir: _ // // FIXME: remove copy-pasta // mounts: nodeModules: { - // contents: dagger.#CacheDir & { + // contents: core.#CacheDir & { // // FIXME: do we need an ID here? // id: "\(mix.app)_assets_node_modules" // // FIXME: does this command need write access to node_modules cache? @@ -55,7 +55,7 @@ actions: { // } // // FIXME: move this to a reusable def (yarn package? or private?) // mounts: nodeModules: { - // contents: dagger.#CacheDir & { + // contents: core.#CacheDir & { // // FIXME: do we need an ID here? // id: "\(mix.app)_assets_node_modules" // // FIXME: will there be multiple writers? diff --git a/pkg/universe.dagger.io/examples/changelog.com/elixir/mix/mix.cue b/pkg/universe.dagger.io/examples/changelog.com/elixir/mix/mix.cue index 5a397a6a..d007a274 100644 --- a/pkg/universe.dagger.io/examples/changelog.com/elixir/mix/mix.cue +++ b/pkg/universe.dagger.io/examples/changelog.com/elixir/mix/mix.cue @@ -67,7 +67,7 @@ import ( } if cache.deps != null { mounts: deps: { - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { id: "\(app.name)_deps" concurrency: cache.deps } @@ -76,7 +76,7 @@ import ( } if cache.build != null { mounts: buildCache: { - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { id: "\(app.name)_build_\(env)" concurrency: cache.build } diff --git a/pkg/universe.dagger.io/examples/todoapp/todoapp.cue b/pkg/universe.dagger.io/examples/todoapp/todoapp.cue index 9dcd1b02..378f4e89 100644 --- a/pkg/universe.dagger.io/examples/todoapp/todoapp.cue +++ b/pkg/universe.dagger.io/examples/todoapp/todoapp.cue @@ -2,6 +2,7 @@ package todoapp import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/alpine" "universe.dagger.io/bash" "universe.dagger.io/docker" @@ -9,10 +10,10 @@ import ( ) dagger.#Plan & { - _nodeModulesMount: "/src/node_modules": dagger.#Mount & { + _nodeModulesMount: "/src/node_modules": { dest: "/src/node_modules" type: "cache" - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { id: "todoapp-modules-cache" } @@ -53,10 +54,10 @@ dagger.#Plan & { bash.#Run & { workdir: "/src" mounts: { - "/cache/yarn": dagger.#Mount & { + "/cache/yarn": { dest: "/cache/yarn" type: "cache" - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { id: "todoapp-yarn-cache" } } @@ -89,7 +90,7 @@ dagger.#Plan & { """# } - contents: dagger.#Subdir & { + contents: core.#Subdir & { input: run.output.rootfs path: "/src/build" } diff --git a/pkg/universe.dagger.io/git/git.cue b/pkg/universe.dagger.io/git/git.cue index 36dbb06f..c6971ea4 100644 --- a/pkg/universe.dagger.io/git/git.cue +++ b/pkg/universe.dagger.io/git/git.cue @@ -1,7 +1,8 @@ package git import ( + "dagger.io/dagger/core" ) -#Pull: dagger.#GitPull -#Push: dagger.#GitPush +#Pull: core.#GitPull +#Push: core.#GitPush diff --git a/pkg/universe.dagger.io/go/container.cue b/pkg/universe.dagger.io/go/container.cue index b4338cf0..d53009dd 100644 --- a/pkg/universe.dagger.io/go/container.cue +++ b/pkg/universe.dagger.io/go/container.cue @@ -3,6 +3,7 @@ package go import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) @@ -30,7 +31,7 @@ import ( contents: source } "go assets cache": { - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { id: "\(name)_assets" } dest: _cachePath diff --git a/pkg/universe.dagger.io/go/test/build.cue b/pkg/universe.dagger.io/go/test/build.cue index 0c380fe4..4304b140 100644 --- a/pkg/universe.dagger.io/go/test/build.cue +++ b/pkg/universe.dagger.io/go/test/build.cue @@ -2,6 +2,7 @@ package go import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/go" "universe.dagger.io/docker" "universe.dagger.io/alpine" @@ -32,7 +33,7 @@ dagger.#Plan & { } } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: exec.output.rootfs path: "/output.txt" } & { diff --git a/pkg/universe.dagger.io/netlify/netlify.cue b/pkg/universe.dagger.io/netlify/netlify.cue index 5e935269..f88ba273 100644 --- a/pkg/universe.dagger.io/netlify/netlify.cue +++ b/pkg/universe.dagger.io/netlify/netlify.cue @@ -4,6 +4,7 @@ package netlify import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/alpine" "universe.dagger.io/docker" @@ -60,7 +61,7 @@ import ( container: bash.#Run & { input: *_build.output | docker.#Image script: { - _load: dagger.#Source & { + _load: core.#Source & { path: "." include: ["*.sh"] } diff --git a/pkg/universe.dagger.io/netlify/test/test.cue b/pkg/universe.dagger.io/netlify/test/test.cue index 57d8a8b2..897d5796 100644 --- a/pkg/universe.dagger.io/netlify/test/test.cue +++ b/pkg/universe.dagger.io/netlify/test/test.cue @@ -2,6 +2,7 @@ package netlify import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" "universe.dagger.io/netlify" @@ -20,7 +21,7 @@ dagger.#Plan & { // Configuration common to all tests common: { - testSecrets: dagger.#DecodeSecret & { + testSecrets: core.#DecodeSecret & { input: client.commands.sops.stdout format: "yaml" } @@ -29,7 +30,7 @@ dagger.#Plan & { marker: "hello world" - data: dagger.#WriteFile & { + data: core.#WriteFile & { input: dagger.#Scratch path: "index.html" contents: marker diff --git a/pkg/universe.dagger.io/powershell/powershell.cue b/pkg/universe.dagger.io/powershell/powershell.cue index 3500478e..7579cfb4 100644 --- a/pkg/universe.dagger.io/powershell/powershell.cue +++ b/pkg/universe.dagger.io/powershell/powershell.cue @@ -3,6 +3,7 @@ package powershell import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" ) @@ -26,7 +27,7 @@ import ( contents: string _filename: "run.ps1" - _write: dagger.#WriteFile & { + _write: core.#WriteFile & { input: dagger.#Scratch path: _filename "contents": contents diff --git a/pkg/universe.dagger.io/powershell/test/test.cue b/pkg/universe.dagger.io/powershell/test/test.cue index 37ad0cba..0ac8da25 100644 --- a/pkg/universe.dagger.io/powershell/test/test.cue +++ b/pkg/universe.dagger.io/powershell/test/test.cue @@ -2,6 +2,7 @@ package powershell import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" "universe.dagger.io/powershell" @@ -19,7 +20,7 @@ dagger.#Plan & { runFile: { dir: _load.output - _load: dagger.#Source & { + _load: core.#Source & { path: "./data" include: ["*.ps1"] } diff --git a/pkg/universe.dagger.io/yarn/test/test.cue b/pkg/universe.dagger.io/yarn/test/test.cue index bc761558..6929a304 100644 --- a/pkg/universe.dagger.io/yarn/test/test.cue +++ b/pkg/universe.dagger.io/yarn/test/test.cue @@ -2,6 +2,7 @@ package yarn import ( "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/docker" "universe.dagger.io/yarn" @@ -78,7 +79,7 @@ dagger.#Plan & { path: string contents: string - _read: dagger.#ReadFile & { + _read: core.#ReadFile & { "input": input "path": path } diff --git a/pkg/universe.dagger.io/yarn/yarn.cue b/pkg/universe.dagger.io/yarn/yarn.cue index d3d9c9b9..a5f36c56 100644 --- a/pkg/universe.dagger.io/yarn/yarn.cue +++ b/pkg/universe.dagger.io/yarn/yarn.cue @@ -5,6 +5,7 @@ import ( "strings" "dagger.io/dagger" + "dagger.io/dagger/core" "universe.dagger.io/alpine" "universe.dagger.io/bash" @@ -78,7 +79,7 @@ import ( mounts: "yarn cache": { dest: "/cache/yarn" - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { // FIXME: are there character limitations in cache ID? id: "universe.dagger.io/yarn.#Run \(name)" } @@ -109,7 +110,7 @@ import ( mounts: "yarn cache": { dest: "/cache/yarn" - contents: dagger.#CacheDir & { + contents: core.#CacheDir & { // FIXME: are there character limitations in cache ID? id: "universe.dagger.io/yarn.#Run \(name)" } @@ -135,7 +136,7 @@ import ( } // The final contents of the package after run - _output: dagger.#Subdir & { + _output: core.#Subdir & { input: _run.output.rootfs path: "/build" } diff --git a/plan/task/task.go b/plan/task/task.go index 516b7d70..937a4a9b 100644 --- a/plan/task/task.go +++ b/plan/task/task.go @@ -20,6 +20,11 @@ var ( cue.Str("$dagger"), cue.Str("task"), cue.Hid("_name", pkg.DaggerPackage)) + corePath = cue.MakePath( + cue.Str("$dagger"), + cue.Str("task"), + cue.Hid("_name", pkg.DaggerCorePackage)) + paths = []cue.Path{corePath, typePath} ) // State is the state of the task. @@ -64,12 +69,7 @@ func Lookup(v *compiler.Value) (Task, error) { return nil, ErrNotTask } - typ := v.LookupPath(typePath) - if !typ.Exists() { - return nil, ErrNotTask - } - - typeString, err := typ.String() + typeString, err := lookupType(v) if err != nil { return nil, err } @@ -81,3 +81,13 @@ func Lookup(v *compiler.Value) (Task, error) { return t, nil } + +func lookupType(v *compiler.Value) (string, error) { + for _, path := range paths { + typ := v.LookupPath(path) + if typ.Exists() { + return typ.String() + } + } + return "", ErrNotTask +} diff --git a/source.cue b/source.cue index 157626c4..c5213142 100644 --- a/source.cue +++ b/source.cue @@ -1,10 +1,10 @@ package main import ( - "dagger.io/dagger" + "dagger.io/dagger/core" ) -_source: dagger.#Source & { +_source: core.#Source & { path: "." exclude: [ "ci", diff --git a/tests/plan.bats b/tests/plan.bats index 8f20d3d7..90260316 100644 --- a/tests/plan.bats +++ b/tests/plan.bats @@ -36,6 +36,7 @@ setup() { assert_output --partial 'client.filesystem."./test_do".write' refute_output --partial "actions.notMe" refute_output --partial 'client.filesystem."./dependent_do".write' + rm -f ./test_do } @test "plan/do: nice error message for 0.1.0 projects" { diff --git a/tests/plan/client/commands/test.cue b/tests/plan/client/commands/test.cue index d93b30e3..0f9e49f7 100644 --- a/tests/plan/client/commands/test.cue +++ b/tests/plan/client/commands/test.cue @@ -3,6 +3,7 @@ package main import ( "strings" "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -28,28 +29,28 @@ dagger.#Plan & { invalid: name: "foobar" } actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } test: { - invalid: dagger.#Exec & { + invalid: core.#Exec & { input: image.output args: ["echo", client.commands.invalid.stdout] } valid: { - normal: dagger.#Exec & { + normal: core.#Exec & { input: image.output args: ["test", strings.TrimSpace(client.commands.normal.stdout), "=", "hello europa"] } - relative: dagger.#Exec & { + relative: core.#Exec & { input: image.output args: ["test", strings.TrimSpace(client.commands.relative.stdout), "=", "test"] } - error: dagger.#Exec & { + error: core.#Exec & { input: image.output args: ["test", strings.TrimSpace(client.commands.error.stderr), "=", "error"] } - secret: dagger.#Exec & { + secret: core.#Exec & { input: image.output mounts: secret: { dest: "/run/secrets/test" diff --git a/tests/plan/client/env/concrete.cue b/tests/plan/client/env/concrete.cue index 5cbd4656..613eefe8 100644 --- a/tests/plan/client/env/concrete.cue +++ b/tests/plan/client/env/concrete.cue @@ -2,16 +2,17 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: env: TEST_FAIL: "env" actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - test: dagger.#Exec & { + test: core.#Exec & { input: image.output args: [client.env.TEST_FAIL] } diff --git a/tests/plan/client/env/usage.cue b/tests/plan/client/env/usage.cue index 2c48785f..5ca80503 100644 --- a/tests/plan/client/env/usage.cue +++ b/tests/plan/client/env/usage.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -10,15 +11,15 @@ dagger.#Plan & { TEST_SECRET: dagger.#Secret } actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } test: { - string: dagger.#Exec & { + string: core.#Exec & { input: image.output args: ["test", client.env.TEST_STRING, "=", "foo"] } - secret: dagger.#Exec & { + secret: core.#Exec & { input: image.output mounts: secret: { dest: "/run/secrets/test" diff --git a/tests/plan/client/filesystem/conflict/test.cue b/tests/plan/client/filesystem/conflict/test.cue index 45843e1d..990af4b7 100644 --- a/tests/plan/client/filesystem/conflict/test.cue +++ b/tests/plan/client/filesystem/conflict/test.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -11,15 +12,15 @@ dagger.#Plan & { write: contents: actions.test.export.contents } actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } test: { - read: dagger.#Exec & { + read: core.#Exec & { input: image.output args: ["echo", client.filesystem."test.txt".read.contents] } - write: dagger.#Exec & { + write: core.#Exec & { input: image.output args: ["sh", "-c", #""" @@ -27,7 +28,7 @@ dagger.#Plan & { """#, ] } - export: dagger.#ReadFile & { + export: core.#ReadFile & { input: write.output path: "out.txt" } diff --git a/tests/plan/client/filesystem/read/file/test.cue b/tests/plan/client/filesystem/read/file/test.cue index 6d608238..d90b69d2 100644 --- a/tests/plan/client/filesystem/read/file/test.cue +++ b/tests/plan/client/filesystem/read/file/test.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -11,20 +12,20 @@ dagger.#Plan & { "secret.txt": read: contents: dagger.#Secret } actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } test: { - concrete: dagger.#Exec & { + concrete: core.#Exec & { input: image.output args: ["sh", "-c", client.filesystem."cmd.sh".read.contents] } usage: { - string: dagger.#Exec & { + string: core.#Exec & { input: image.output args: ["test", client.filesystem."test.txt".read.contents, "=", "foo"] } - secret: dagger.#Exec & { + secret: core.#Exec & { input: image.output mounts: secret: { dest: "/run/secrets/test" diff --git a/tests/plan/client/filesystem/read/fs/relative/test.cue b/tests/plan/client/filesystem/read/fs/relative/test.cue index 5dc984ad..a8f2a970 100644 --- a/tests/plan/client/filesystem/read/fs/relative/test.cue +++ b/tests/plan/client/filesystem/read/fs/relative/test.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -10,7 +11,7 @@ dagger.#Plan & { include: ["*.txt"] } actions: test: { - [string]: dagger.#ReadFile & { + [string]: core.#ReadFile & { input: client.filesystem."../rootfs".read.contents } valid: { diff --git a/tests/plan/client/filesystem/read/fs/usage/test.cue b/tests/plan/client/filesystem/read/fs/usage/test.cue index 792d69a5..2e8525c0 100644 --- a/tests/plan/client/filesystem/read/fs/usage/test.cue +++ b/tests/plan/client/filesystem/read/fs/usage/test.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -10,7 +11,7 @@ dagger.#Plan & { exclude: ["*.log"] } actions: test: { - [string]: dagger.#ReadFile & { + [string]: core.#ReadFile & { input: client.filesystem.rootfs.read.contents } valid: { diff --git a/tests/plan/client/filesystem/read/service/invalid.cue b/tests/plan/client/filesystem/read/service/invalid.cue index 90125fcb..39000fa9 100644 --- a/tests/plan/client/filesystem/read/service/invalid.cue +++ b/tests/plan/client/filesystem/read/service/invalid.cue @@ -2,22 +2,23 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: "/var/run/docker.soc": read: contents: dagger.#Service actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - imageWithDocker: dagger.#Exec & { + imageWithDocker: core.#Exec & { input: image.output args: ["apk", "add", "--no-cache", "docker-cli"] } - test: dagger.#Exec & { + test: core.#Exec & { input: imageWithDocker.output mounts: docker: { dest: "/var/run/docker.sock" diff --git a/tests/plan/client/filesystem/read/service/valid.cue b/tests/plan/client/filesystem/read/service/valid.cue index 3954244b..cf218c47 100644 --- a/tests/plan/client/filesystem/read/service/valid.cue +++ b/tests/plan/client/filesystem/read/service/valid.cue @@ -2,22 +2,23 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - imageWithDocker: dagger.#Exec & { + imageWithDocker: core.#Exec & { input: image.output args: ["apk", "add", "--no-cache", "docker-cli"] } - test: dagger.#Exec & { + test: core.#Exec & { input: imageWithDocker.output mounts: docker: { dest: "/var/run/docker.sock" diff --git a/tests/plan/client/filesystem/read/service/windows.cue b/tests/plan/client/filesystem/read/service/windows.cue index 2c383387..129de88d 100644 --- a/tests/plan/client/filesystem/read/service/windows.cue +++ b/tests/plan/client/filesystem/read/service/windows.cue @@ -2,22 +2,23 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: "//./pipe/docker_engine": read: contents: dagger.#Service actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - imageWithDocker: dagger.#Exec & { + imageWithDocker: core.#Exec & { input: image.output args: ["apk", "add", "--no-cache", "docker-cli"] } - test: dagger.#Exec & { + test: core.#Exec & { input: imageWithDocker.output mounts: docker: { dest: "/var/run/docker.sock" diff --git a/tests/plan/client/filesystem/write/test.cue b/tests/plan/client/filesystem/write/test.cue index 4e0d8755..35f3dd7b 100644 --- a/tests/plan/client/filesystem/write/test.cue +++ b/tests/plan/client/filesystem/write/test.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -15,30 +16,30 @@ dagger.#Plan & { } actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } test: { - fs: data: dagger.#WriteFile & { + fs: data: core.#WriteFile & { input: dagger.#Scratch path: "/test" contents: "foobar" } file: { // Only using contents for reference in client - data: dagger.#WriteFile & { + data: core.#WriteFile & { input: dagger.#Scratch path: "/test" contents: "foobaz" } } secret: { - create: dagger.#WriteFile & { + create: core.#WriteFile & { input: dagger.#Scratch path: "/test" contents: "foo-barab-oof" } - data: dagger.#NewSecret & { + data: core.#NewSecret & { input: create.output path: "/test" } diff --git a/tests/plan/hello-europa/main.cue b/tests/plan/hello-europa/main.cue index 37bb61cf..6ee70c6e 100644 --- a/tests/plan/hello-europa/main.cue +++ b/tests/plan/hello-europa/main.cue @@ -2,21 +2,21 @@ package main import ( "dagger.io/dagger" - // "alpha.dagger.io/os" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: test: { - _image: dagger.#Pull & { + _image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - _exec: dagger.#Exec & { + _exec: core.#Exec & { input: _image.output args: ["sh", "-c", "echo -n Hello Europa > /out.txt"] } - _verify: dagger.#ReadFile & { + _verify: core.#ReadFile & { input: _exec.output path: "/out.txt" } & { diff --git a/tests/plan/platform/config_platform_failure_invalid_platform.cue b/tests/plan/platform/config_platform_failure_invalid_platform.cue index bce5b75e..6de027d8 100644 --- a/tests/plan/platform/config_platform_failure_invalid_platform.cue +++ b/tests/plan/platform/config_platform_failure_invalid_platform.cue @@ -1,17 +1,19 @@ package main import ( + "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { platform: "linux/unknown" actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0" } - writeArch: dagger.#Exec & { + writeArch: core.#Exec & { input: image.output always: true args: [ @@ -21,7 +23,7 @@ dagger.#Plan & { ] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: writeArch.output path: "/arch.txt" } & { diff --git a/tests/plan/platform/config_platform_linux_amd64.cue b/tests/plan/platform/config_platform_linux_amd64.cue index bf98009f..366482ec 100644 --- a/tests/plan/platform/config_platform_linux_amd64.cue +++ b/tests/plan/platform/config_platform_linux_amd64.cue @@ -1,17 +1,19 @@ package main import ( + "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { platform: "linux/amd64" actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0" } - writeArch: dagger.#Exec & { + writeArch: core.#Exec & { input: image.output always: true args: [ @@ -21,7 +23,7 @@ dagger.#Plan & { ] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: writeArch.output path: "/arch.txt" } & { diff --git a/tests/plan/platform/config_platform_linux_arm64.cue b/tests/plan/platform/config_platform_linux_arm64.cue index 45a4156f..9ffc213e 100644 --- a/tests/plan/platform/config_platform_linux_arm64.cue +++ b/tests/plan/platform/config_platform_linux_arm64.cue @@ -1,17 +1,19 @@ package main import ( + "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { platform: "linux/arm64" actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0" } - writeArch: dagger.#Exec & { + writeArch: core.#Exec & { input: image.output always: true args: [ @@ -21,7 +23,7 @@ dagger.#Plan & { ] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: writeArch.output path: "/arch.txt" } & { diff --git a/tests/plan/with/with.cue b/tests/plan/with/with.cue index 2021b4d0..add28fe8 100644 --- a/tests/plan/with/with.cue +++ b/tests/plan/with/with.cue @@ -2,18 +2,19 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { params: foo: string - _image: dagger.#Pull & { + _image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } test: { - [string]: dagger.#Exec & { + [string]: core.#Exec & { input: _image.output env: FOO: string args: [ diff --git a/tests/tasks.bats b/tests/tasks.bats index a57342a6..ea21c87c 100644 --- a/tests/tasks.bats +++ b/tests/tasks.bats @@ -63,7 +63,7 @@ setup() { @test "task: #Dockerfile" { cd "$TESTDIR"/tasks/dockerfile - "$DAGGER" "do" -p ./dockerfile.cue + "$DAGGER" "do" -p ./dockerfile.cue verify "$DAGGER" "do" -p ./inlined_dockerfile.cue verify "$DAGGER" "do" -p ./inlined_dockerfile_heredoc.cue verify "$DAGGER" "do" -p ./dockerfile_path.cue verify diff --git a/tests/tasks/copy/copy_exec.cue b/tests/tasks/copy/copy_exec.cue index c93b7669..33a9ed23 100644 --- a/tests/tasks/copy/copy_exec.cue +++ b/tests/tasks/copy/copy_exec.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output args: [ "sh", "-c", @@ -20,7 +21,7 @@ dagger.#Plan & { ] } test: { - verify_file: dagger.#ReadFile & { + verify_file: core.#ReadFile & { input: exec.output path: "/output.txt" } & { @@ -28,14 +29,14 @@ dagger.#Plan & { contents: "hello world" } - copy: dagger.#Copy & { + copy: core.#Copy & { input: image.output contents: exec.output source: "/output.txt" dest: "/output.txt" } - verify_copy: dagger.#ReadFile & { + verify_copy: core.#ReadFile & { input: copy.output path: "/output.txt" } & { diff --git a/tests/tasks/copy/copy_exec_invalid.cue b/tests/tasks/copy/copy_exec_invalid.cue index 15482935..2431315f 100644 --- a/tests/tasks/copy/copy_exec_invalid.cue +++ b/tests/tasks/copy/copy_exec_invalid.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output args: [ "sh", "-c", @@ -21,7 +22,7 @@ dagger.#Plan & { } test: { - verify_file: dagger.#ReadFile & { + verify_file: core.#ReadFile & { input: exec.output path: "/output.txt" } & { @@ -29,13 +30,13 @@ dagger.#Plan & { contents: "hello world from dagger" } - copy: dagger.#Copy & { + copy: core.#Copy & { input: image.output contents: exec.output source: "/output.txt" dest: "/output.txt" } - verify_copy: dagger.#ReadFile & { + verify_copy: core.#ReadFile & { input: copy.output path: "/output.txt" } & { diff --git a/tests/tasks/copy/copy_file.cue b/tests/tasks/copy/copy_file.cue index a9d5526a..52f679aa 100644 --- a/tests/tasks/copy/copy_file.cue +++ b/tests/tasks/copy/copy_file.cue @@ -2,20 +2,21 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - alpine3_15_0: dagger.#Pull & { + alpine3_15_0: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - busybox1_34_1: dagger.#Pull & { + busybox1_34_1: core.#Pull & { source: "busybox:1.34.1-glibc@sha256:ec98391b8f0911db08be2ee6c46813eeac17b9625b402ea1ce45dcfcd05d78d6" } test: { - verify_alpine_3_15_0: dagger.#ReadFile & { + verify_alpine_3_15_0: core.#ReadFile & { input: alpine3_15_0.output path: "/etc/alpine-release" } & { @@ -23,14 +24,14 @@ dagger.#Plan & { contents: "3.15.0\n" } - copy: dagger.#Copy & { + copy: core.#Copy & { input: busybox1_34_1.output contents: alpine3_15_0.output source: "/etc/alpine-release" dest: "/alpine3_15_0_release" } - verify_copy: dagger.#ReadFile & { + verify_copy: core.#ReadFile & { input: copy.output path: "/alpine3_15_0_release" } & { diff --git a/tests/tasks/diff/diff.cue b/tests/tasks/diff/diff.cue index 77574a08..7a625f92 100644 --- a/tests/tasks/diff/diff.cue +++ b/tests/tasks/diff/diff.cue @@ -2,18 +2,19 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - alpineBase: dagger.#Pull & { + alpineBase: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - busyboxBase: dagger.#Pull & { + busyboxBase: core.#Pull & { source: "busybox:1.34.1@sha256:1286c6d3c393023ef93c247724a6a2d665528144ffe07bacb741cc2b4edfefad" } - exec1: dagger.#Exec & { + exec1: core.#Exec & { input: alpineBase.output args: [ "sh", "-c", @@ -23,7 +24,7 @@ dagger.#Plan & { ] } - exec2: dagger.#Exec & { + exec2: core.#Exec & { input: exec1.output args: [ "sh", "-c", @@ -33,46 +34,46 @@ dagger.#Plan & { ] } - removeme: dagger.#WriteFile & { + removeme: core.#WriteFile & { input: dagger.#Scratch path: "/removeme" contents: "removeme" } test: { - diff: dagger.#Diff & { + diff: core.#Diff & { lower: alpineBase.output upper: exec2.output } - verify_diff_foo: dagger.#ReadFile & { + verify_diff_foo: core.#ReadFile & { input: diff.output path: "/dir/foo" } & { contents: "foo" } - verify_diff_bar: dagger.#ReadFile & { + verify_diff_bar: core.#ReadFile & { input: diff.output path: "/dir/bar" } & { contents: "bar" } - mergediff: dagger.#Merge & { + mergediff: core.#Merge & { inputs: [ busyboxBase.output, removeme.output, diff.output, ] } - verify_remove: dagger.#Exec & { + verify_remove: core.#Exec & { input: mergediff.output args: ["test", "!", "-e", "/removeme"] } - verify_no_alpine_base: dagger.#Exec & { + verify_no_alpine_base: core.#Exec & { input: mergediff.output // make sure the the Diff actually separated files from the base - // by testing the non-existence of a file that only exists in the + // by testing the non-existence of a file that only exists in the // alpine base, not busybox args: ["test", "!", "-e", "/etc/alpine-release"] } diff --git a/tests/tasks/dockerfile/build_args.cue b/tests/tasks/dockerfile/build_args.cue index 5718f71c..c868f978 100644 --- a/tests/tasks/dockerfile/build_args.cue +++ b/tests/tasks/dockerfile/build_args.cue @@ -2,12 +2,13 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: testdata: read: contents: dagger.#FS - actions: build: dagger.#Dockerfile & { + actions: build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/dockerfile/build_auth.cue b/tests/tasks/dockerfile/build_auth.cue index 9a664e34..387aa902 100644 --- a/tests/tasks/dockerfile/build_auth.cue +++ b/tests/tasks/dockerfile/build_auth.cue @@ -2,6 +2,7 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -15,12 +16,12 @@ dagger.#Plan & { } actions: { - sopsSecrets: dagger.#DecodeSecret & { + sopsSecrets: core.#DecodeSecret & { format: "yaml" input: client.commands.sops.stdout } - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents auth: "daggerio/ci-test:private-pull": { username: "daggertest" diff --git a/tests/tasks/dockerfile/dockerfile.cue b/tests/tasks/dockerfile/dockerfile.cue index d2bfded6..d007c162 100644 --- a/tests/tasks/dockerfile/dockerfile.cue +++ b/tests/tasks/dockerfile/dockerfile.cue @@ -2,17 +2,18 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: testdata: read: contents: dagger.#FS actions: { - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents } - verify: dagger.#Exec & { + verify: core.#Exec & { input: build.output args: ["sh", "-c", "test $(cat /dir/foo) = foobar"] } diff --git a/tests/tasks/dockerfile/dockerfile_path.cue b/tests/tasks/dockerfile/dockerfile_path.cue index feb7922a..5ad03ea6 100644 --- a/tests/tasks/dockerfile/dockerfile_path.cue +++ b/tests/tasks/dockerfile/dockerfile_path.cue @@ -2,18 +2,19 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: testdata: read: contents: dagger.#FS actions: { - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents dockerfile: path: "./dockerfilepath/Dockerfile.custom" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: build.output args: ["sh", "-c", "test $(cat /test) = dockerfilePath"] } diff --git a/tests/tasks/dockerfile/image_config.cue b/tests/tasks/dockerfile/image_config.cue index b3e01757..58728cda 100644 --- a/tests/tasks/dockerfile/image_config.cue +++ b/tests/tasks/dockerfile/image_config.cue @@ -2,6 +2,7 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -9,7 +10,7 @@ dagger.#Plan & { actions: { // FIXME: this doesn't test anything beside not crashing - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/dockerfile/inlined_dockerfile.cue b/tests/tasks/dockerfile/inlined_dockerfile.cue index ca59eb39..9f382422 100644 --- a/tests/tasks/dockerfile/inlined_dockerfile.cue +++ b/tests/tasks/dockerfile/inlined_dockerfile.cue @@ -2,13 +2,14 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: testdata: read: contents: dagger.#FS actions: { - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d @@ -16,7 +17,7 @@ dagger.#Plan & { """ } - verify: dagger.#Exec & { + verify: core.#Exec & { input: build.output args: ["sh", "-c", "test $(cat /output) = foobar"] } diff --git a/tests/tasks/dockerfile/inlined_dockerfile_heredoc.cue b/tests/tasks/dockerfile/inlined_dockerfile_heredoc.cue index 5e17cd16..a9052902 100644 --- a/tests/tasks/dockerfile/inlined_dockerfile_heredoc.cue +++ b/tests/tasks/dockerfile/inlined_dockerfile_heredoc.cue @@ -2,13 +2,14 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: testdata: read: contents: dagger.#FS actions: { - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents dockerfile: contents: """ # syntax = docker/dockerfile:1.3 @@ -17,7 +18,7 @@ dagger.#Plan & { """ } - verify: dagger.#Exec & { + verify: core.#Exec & { input: build.output args: ["sh", "-c", "test $(cat /output) = foobar"] } diff --git a/tests/tasks/dockerfile/labels.cue b/tests/tasks/dockerfile/labels.cue index 492dc35e..702c4b70 100644 --- a/tests/tasks/dockerfile/labels.cue +++ b/tests/tasks/dockerfile/labels.cue @@ -2,6 +2,7 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -9,7 +10,7 @@ dagger.#Plan & { actions: { // FIXME: this doesn't test anything beside not crashing - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/dockerfile/platform.cue b/tests/tasks/dockerfile/platform.cue index c45d10a6..1ce191de 100644 --- a/tests/tasks/dockerfile/platform.cue +++ b/tests/tasks/dockerfile/platform.cue @@ -2,6 +2,7 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -9,7 +10,7 @@ dagger.#Plan & { actions: { // FIXME: this doesn't test anything beside not crashing - build: dagger.#Dockerfile & { + build: core.#Dockerfile & { source: client.filesystem.testdata.read.contents dockerfile: contents: """ FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d diff --git a/tests/tasks/exec/args.cue b/tests/tasks/exec/args.cue index befe4ea8..7a47832d 100644 --- a/tests/tasks/exec/args.cue +++ b/tests/tasks/exec/args.cue @@ -2,20 +2,21 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output args: ["sh", "-c", "echo -n hello world > /output.txt"] } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: exec.output path: "/output.txt" } & { diff --git a/tests/tasks/exec/env.cue b/tests/tasks/exec/env.cue index e74a2c7c..4b20a816 100644 --- a/tests/tasks/exec/env.cue +++ b/tests/tasks/exec/env.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output env: TEST: "hello world" args: [ diff --git a/tests/tasks/exec/env_secret.cue b/tests/tasks/exec/env_secret.cue index 150d9395..a64e5779 100644 --- a/tests/tasks/exec/env_secret.cue +++ b/tests/tasks/exec/env_secret.cue @@ -2,17 +2,18 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: "secret.txt": read: contents: dagger.#Secret actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output env: TEST: client.filesystem."secret.txt".read.contents args: [ diff --git a/tests/tasks/exec/hosts.cue b/tests/tasks/exec/hosts.cue index 428fbeb4..c4f5b6b7 100644 --- a/tests/tasks/exec/hosts.cue +++ b/tests/tasks/exec/hosts.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output hosts: "unit.test": "1.2.3.4" args: [ diff --git a/tests/tasks/exec/mount_cache.cue b/tests/tasks/exec/mount_cache.cue index e344c7a7..acd0367d 100644 --- a/tests/tasks/exec/mount_cache.cue +++ b/tests/tasks/exec/mount_cache.cue @@ -2,19 +2,20 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - sharedCache: dagger.#CacheDir & { + sharedCache: core.#CacheDir & { id: "mycache" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output mounts: cache: { dest: "/cache" @@ -29,7 +30,7 @@ dagger.#Plan & { } test: { - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output mounts: cache: { dest: "/cache" @@ -44,10 +45,10 @@ dagger.#Plan & { ] } - otherCache: dagger.#CacheDir & { + otherCache: core.#CacheDir & { id: "othercache" } - verifyOtherCache: dagger.#Exec & { + verifyOtherCache: core.#Exec & { input: image.output mounts: cache: { dest: "/cache" diff --git a/tests/tasks/exec/mount_fs.cue b/tests/tasks/exec/mount_fs.cue index 1bf0827e..ff49dade 100644 --- a/tests/tasks/exec/mount_fs.cue +++ b/tests/tasks/exec/mount_fs.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output args: [ "sh", "-c", @@ -21,7 +22,7 @@ dagger.#Plan & { } test: { - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output mounts: fs: { dest: "/target" @@ -36,7 +37,7 @@ dagger.#Plan & { ] } - verifyRO: dagger.#Exec & { + verifyRO: core.#Exec & { input: image.output mounts: fs: { dest: "/target" @@ -54,7 +55,7 @@ dagger.#Plan & { ] } - verifySource: dagger.#Exec & { + verifySource: core.#Exec & { input: image.output mounts: fs: { dest: "/target.txt" diff --git a/tests/tasks/exec/mount_secret.cue b/tests/tasks/exec/mount_secret.cue index babd2ed6..633da529 100644 --- a/tests/tasks/exec/mount_secret.cue +++ b/tests/tasks/exec/mount_secret.cue @@ -2,17 +2,18 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: env: TESTSECRET: dagger.#Secret actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } test: { - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output mounts: secret: { dest: "/run/secrets/test" @@ -27,7 +28,7 @@ dagger.#Plan & { ] } - verifyPerm: dagger.#Exec & { + verifyPerm: core.#Exec & { input: image.output mounts: secret: { dest: "/run/secrets/test" diff --git a/tests/tasks/exec/mount_service.cue b/tests/tasks/exec/mount_service.cue index 6a61fc65..1c5beca9 100644 --- a/tests/tasks/exec/mount_service.cue +++ b/tests/tasks/exec/mount_service.cue @@ -2,22 +2,23 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - imageWithDocker: dagger.#Exec & { + imageWithDocker: core.#Exec & { input: image.output args: ["apk", "add", "--no-cache", "docker-cli"] } - verify: dagger.#Exec & { + verify: core.#Exec & { input: imageWithDocker.output mounts: docker: { dest: "/var/run/docker.sock" diff --git a/tests/tasks/exec/mount_tmp.cue b/tests/tasks/exec/mount_tmp.cue index 50f1bb48..c21676dc 100644 --- a/tests/tasks/exec/mount_tmp.cue +++ b/tests/tasks/exec/mount_tmp.cue @@ -2,19 +2,20 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output mounts: temp: { dest: "/temp" - contents: dagger.#TempDir + contents: core.#TempDir } args: [ "sh", "-c", @@ -24,7 +25,7 @@ dagger.#Plan & { ] } - verify: dagger.#Exec & { + verify: core.#Exec & { input: exec.output args: [ "sh", "-c", diff --git a/tests/tasks/exec/user.cue b/tests/tasks/exec/user.cue index bca459a0..6b91b88c 100644 --- a/tests/tasks/exec/user.cue +++ b/tests/tasks/exec/user.cue @@ -2,20 +2,21 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - addUser: dagger.#Exec & { + addUser: core.#Exec & { input: image.output args: ["adduser", "-D", "test"] } test: { - verifyUsername: dagger.#Exec & { + verifyUsername: core.#Exec & { input: addUser.output user: "test" args: [ @@ -26,7 +27,7 @@ dagger.#Plan & { ] } - verifyUserID: dagger.#Exec & { + verifyUserID: core.#Exec & { input: addUser.output user: "1000" args: [ diff --git a/tests/tasks/exec/workdir.cue b/tests/tasks/exec/workdir.cue index bd3ddd1d..66460462 100644 --- a/tests/tasks/exec/workdir.cue +++ b/tests/tasks/exec/workdir.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output workdir: "/tmp" args: [ diff --git a/tests/tasks/export/export.cue b/tests/tasks/export/export.cue index d57276aa..ae9b8fc2 100644 --- a/tests/tasks/export/export.cue +++ b/tests/tasks/export/export.cue @@ -2,21 +2,22 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: test: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15" } - export: dagger.#Export & { + export: core.#Export & { input: image.output config: image.config tag: "example" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output mounts: exported: { contents: export.output diff --git a/tests/tasks/gitpull/bad_ref.cue b/tests/tasks/gitpull/bad_ref.cue index f13c1d48..e13b5af8 100644 --- a/tests/tasks/gitpull/bad_ref.cue +++ b/tests/tasks/gitpull/bad_ref.cue @@ -2,10 +2,11 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: badref: dagger.#GitPull & { + actions: badref: core.#GitPull & { remote: "https://github.com/blocklayerhq/acme-clothing.git" ref: "lalalalal" } diff --git a/tests/tasks/gitpull/bad_remote.cue b/tests/tasks/gitpull/bad_remote.cue index e11cbd61..dc0d1936 100644 --- a/tests/tasks/gitpull/bad_remote.cue +++ b/tests/tasks/gitpull/bad_remote.cue @@ -2,10 +2,11 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: badremote: dagger.#GitPull & { + actions: badremote: core.#GitPull & { remote: "https://github.com/blocklayerhq/lalalala.git" ref: "master" } diff --git a/tests/tasks/gitpull/exists.cue b/tests/tasks/gitpull/exists.cue index c852fa6f..aac0a4b1 100644 --- a/tests/tasks/gitpull/exists.cue +++ b/tests/tasks/gitpull/exists.cue @@ -2,10 +2,11 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: gitPull: dagger.#GitPull & { + actions: gitPull: core.#GitPull & { remote: "https://github.com/blocklayerhq/acme-clothing.git" ref: "master" } diff --git a/tests/tasks/gitpull/git_dir.cue b/tests/tasks/gitpull/git_dir.cue index 68f184e6..47159e39 100644 --- a/tests/tasks/gitpull/git_dir.cue +++ b/tests/tasks/gitpull/git_dir.cue @@ -2,26 +2,27 @@ package testing import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - repo1: dagger.#GitPull & { + repo1: core.#GitPull & { remote: "https://github.com/blocklayerhq/acme-clothing.git" ref: "master" } - repo2: dagger.#GitPull & { + repo2: core.#GitPull & { remote: "https://github.com/blocklayerhq/acme-clothing.git" ref: "master" keepGitDir: true } - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output args: ["sh", "-c", """ set -eu diff --git a/tests/tasks/gitpull/invalid.cue b/tests/tasks/gitpull/invalid.cue index 726016e9..69125f43 100644 --- a/tests/tasks/gitpull/invalid.cue +++ b/tests/tasks/gitpull/invalid.cue @@ -2,8 +2,9 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: invalid: dagger.#GitPull & {} + actions: invalid: core.#GitPull & {} } diff --git a/tests/tasks/gitpull/private_repo.cue b/tests/tasks/gitpull/private_repo.cue index 08ecde2e..e64be887 100644 --- a/tests/tasks/gitpull/private_repo.cue +++ b/tests/tasks/gitpull/private_repo.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -13,16 +14,16 @@ dagger.#Plan & { actions: { - alpine: dagger.#Pull & { + alpine: core.#Pull & { source: "alpine:3.15.0" } - sopsSecrets: dagger.#DecodeSecret & { + sopsSecrets: core.#DecodeSecret & { format: "yaml" input: client.commands.sops.stdout } - testRepo: dagger.#GitPull & { + testRepo: core.#GitPull & { remote: "https://github.com/dagger/dagger.git" ref: "main" auth: { @@ -31,7 +32,7 @@ dagger.#Plan & { } } - testContent: dagger.#Exec & { + testContent: core.#Exec & { input: alpine.output always: true args: ["ls", "-l", "/repo/README.md"] diff --git a/tests/tasks/hidden/hidden.cue b/tests/tasks/hidden/hidden.cue index 0e790bcd..f28a1a35 100644 --- a/tests/tasks/hidden/hidden.cue +++ b/tests/tasks/hidden/hidden.cue @@ -2,21 +2,22 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" "testing.dagger.io/hidden" ) dagger.#Plan & { actions: { - pull: dagger.#Pull & { + pull: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - _write: dagger.#WriteFile & { + _write: core.#WriteFile & { input: pull.output path: "/testing" contents: "1,2,3" permissions: 700 } - readfile: dagger.#ReadFile & { + readfile: core.#ReadFile & { input: _write.output path: "/testing" } & { diff --git a/tests/tasks/httpfetch/exist.cue b/tests/tasks/httpfetch/exist.cue index c30ed955..31b75768 100644 --- a/tests/tasks/httpfetch/exist.cue +++ b/tests/tasks/httpfetch/exist.cue @@ -2,10 +2,11 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: fetch: dagger.#HTTPFetch & { + actions: fetch: core.#HTTPFetch & { source: "https://releases.dagger.io/dagger/latest_version" dest: "/latest.html" } diff --git a/tests/tasks/httpfetch/not_exist.cue b/tests/tasks/httpfetch/not_exist.cue index 94cfaeb5..757f830a 100644 --- a/tests/tasks/httpfetch/not_exist.cue +++ b/tests/tasks/httpfetch/not_exist.cue @@ -2,10 +2,11 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: fetch: dagger.#HTTPFetch & { + actions: fetch: core.#HTTPFetch & { source: "https://releases.dagger.io/dagger/asfgdsfg" dest: "/latest.html" } diff --git a/tests/tasks/merge/merge.cue b/tests/tasks/merge/merge.cue index d5ae7f2c..2a81853f 100644 --- a/tests/tasks/merge/merge.cue +++ b/tests/tasks/merge/merge.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output args: [ "sh", "-c", @@ -20,31 +21,31 @@ dagger.#Plan & { ] } - dir: dagger.#Mkdir & { + dir: core.#Mkdir & { input: dagger.#Scratch path: "/dir" } - dirfoo: dagger.#WriteFile & { + dirfoo: core.#WriteFile & { input: dir.output path: "/dir/foo" contents: "foo" } - dirfoo2: dagger.#WriteFile & { + dirfoo2: core.#WriteFile & { input: dir.output path: "/dir/foo" contents: "foo2" } - dirbar: dagger.#WriteFile & { + dirbar: core.#WriteFile & { input: dir.output path: "/dir/bar" contents: "bar" } test: { - merge: dagger.#Merge & { + merge: core.#Merge & { inputs: [ dir.output, dirfoo.output, @@ -54,19 +55,19 @@ dagger.#Plan & { ] } - verify_merge_output: dagger.#ReadFile & { + verify_merge_output: core.#ReadFile & { input: merge.output path: "/output.txt" } & { contents: "hello world" } - verify_merge_dirbar: dagger.#ReadFile & { + verify_merge_dirbar: core.#ReadFile & { input: merge.output path: "/dir/bar" } & { contents: "bar" } - verify_merge_dirfoo: dagger.#ReadFile & { + verify_merge_dirfoo: core.#ReadFile & { input: merge.output path: "/dir/foo" } & { diff --git a/tests/tasks/mkdir/mkdir.cue b/tests/tasks/mkdir/mkdir.cue index e2e296dd..fbc4dfa8 100644 --- a/tests/tasks/mkdir/mkdir.cue +++ b/tests/tasks/mkdir/mkdir.cue @@ -2,27 +2,28 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - mkdir: dagger.#Mkdir & { + mkdir: core.#Mkdir & { input: image.output path: "/test" } - writeChecker: dagger.#WriteFile & { + writeChecker: core.#WriteFile & { input: mkdir.output path: "/test/foo" contents: "bar" permissions: 700 } - readChecker: dagger.#ReadFile & { + readChecker: core.#ReadFile & { input: writeChecker.output path: "/test/foo" } & { diff --git a/tests/tasks/mkdir/mkdir_failure_disable_parents.cue b/tests/tasks/mkdir/mkdir_failure_disable_parents.cue index e0952a7a..7ec06b9c 100644 --- a/tests/tasks/mkdir/mkdir_failure_disable_parents.cue +++ b/tests/tasks/mkdir/mkdir_failure_disable_parents.cue @@ -2,28 +2,29 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - mkdir: dagger.#Mkdir & { + mkdir: core.#Mkdir & { input: image.output path: "/test/baz" parents: false } - writeChecker: dagger.#WriteFile & { + writeChecker: core.#WriteFile & { input: mkdir.output path: "/test/baz/foo" contents: "bar" permissions: 700 } - readChecker: dagger.#ReadFile & { + readChecker: core.#ReadFile & { input: writeChecker.output path: "/test/baz/foo" } & { diff --git a/tests/tasks/mkdir/mkdir_parents.cue b/tests/tasks/mkdir/mkdir_parents.cue index d4604787..c575e9a0 100644 --- a/tests/tasks/mkdir/mkdir_parents.cue +++ b/tests/tasks/mkdir/mkdir_parents.cue @@ -2,27 +2,28 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - mkdir: dagger.#Mkdir & { + mkdir: core.#Mkdir & { input: image.output path: "/test/baz" } - writeChecker: dagger.#WriteFile & { + writeChecker: core.#WriteFile & { input: mkdir.output path: "/test/baz/foo" contents: "bar" permissions: 700 } - readChecker: dagger.#ReadFile & { + readChecker: core.#ReadFile & { input: writeChecker.output path: "/test/baz/foo" } & { diff --git a/tests/tasks/newsecret/newsecret.cue b/tests/tasks/newsecret/newsecret.cue index f97edfdb..a3d9e22e 100644 --- a/tests/tasks/newsecret/newsecret.cue +++ b/tests/tasks/newsecret/newsecret.cue @@ -2,25 +2,26 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - generate: dagger.#Exec & { + generate: core.#Exec & { input: image.output args: ["sh", "-c", "echo test > /secret"] } - load: dagger.#NewSecret & { + load: core.#NewSecret & { input: generate.output path: "/secret" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output mounts: secret: { dest: "/run/secrets/test" diff --git a/tests/tasks/pull/pull.cue b/tests/tasks/pull/pull.cue index 9a733a2f..68cc281d 100644 --- a/tests/tasks/pull/pull.cue +++ b/tests/tasks/pull/pull.cue @@ -2,10 +2,11 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: pull: dagger.#Pull & { + actions: pull: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } & { // assert result diff --git a/tests/tasks/pull/pull_auth.cue b/tests/tasks/pull/pull_auth.cue index 273e5d35..aaab9f54 100644 --- a/tests/tasks/pull/pull_auth.cue +++ b/tests/tasks/pull/pull_auth.cue @@ -2,6 +2,7 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -12,12 +13,12 @@ dagger.#Plan & { } actions: { - sopsSecrets: dagger.#DecodeSecret & { + sopsSecrets: core.#DecodeSecret & { format: "yaml" input: client.commands.sops.stdout } - pull: dagger.#Pull & { + pull: core.#Pull & { source: "daggerio/ci-test:private-pull@sha256:c74f1b1166784193ea6c8f9440263b9be6cae07dfe35e32a5df7a31358ac2060" auth: { username: "daggertest" diff --git a/tests/tasks/push/push.cue b/tests/tasks/push/push.cue index 871c6e9c..329b5494 100644 --- a/tests/tasks/push/push.cue +++ b/tests/tasks/push/push.cue @@ -3,6 +3,7 @@ package main import ( "strings" "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { @@ -18,24 +19,24 @@ dagger.#Plan & { } actions: { - sopsSecrets: dagger.#DecodeSecret & { + sopsSecrets: core.#DecodeSecret & { format: "yaml" input: client.commands.sops.stdout } randomString: { - baseImage: dagger.#Pull & { + baseImage: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - image: dagger.#Exec & { + image: core.#Exec & { input: baseImage.output args: [ "sh", "-c", "echo -n $RANDOM > /output.txt", ] } - outputFile: dagger.#ReadFile & { + outputFile: core.#ReadFile & { input: image.output path: "/output.txt" } @@ -44,7 +45,7 @@ dagger.#Plan & { } // Push image with random content - push: dagger.#Push & { + push: core.#Push & { dest: "daggerio/ci-test:\(randomString.output)" input: randomString.image.output config: env: FOO: randomString.output @@ -52,7 +53,7 @@ dagger.#Plan & { } // Pull same image and check the content - pull: dagger.#Pull & { + pull: core.#Pull & { source: "daggerio/ci-test:\(randomString.output)" auth: #auth } & { @@ -62,7 +63,7 @@ dagger.#Plan & { config: env: FOO: randomString.output } - pullOutputFile: dagger.#ReadFile & { + pullOutputFile: core.#ReadFile & { input: pull.output path: "/output.txt" } diff --git a/tests/tasks/readfile/readfile.cue b/tests/tasks/readfile/readfile.cue index befb075b..6872823f 100644 --- a/tests/tasks/readfile/readfile.cue +++ b/tests/tasks/readfile/readfile.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - readfile: dagger.#ReadFile & { + readfile: core.#ReadFile & { input: image.output path: "/etc/alpine-release" } & { diff --git a/tests/tasks/scratch/scratch.cue b/tests/tasks/scratch/scratch.cue index 76e4d94f..805ef704 100644 --- a/tests/tasks/scratch/scratch.cue +++ b/tests/tasks/scratch/scratch.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output mounts: fs: { dest: "/scratch" diff --git a/tests/tasks/scratch/scratch_build_scratch.cue b/tests/tasks/scratch/scratch_build_scratch.cue index cbbcb0f1..1d505c22 100644 --- a/tests/tasks/scratch/scratch_build_scratch.cue +++ b/tests/tasks/scratch/scratch_build_scratch.cue @@ -2,10 +2,11 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { - actions: build: dagger.#Build & { + actions: build: core.#Dockerfile & { source: dagger.#Scratch dockerfile: contents: "FROM scratch" // Assert that output is dagger.#Scratch diff --git a/tests/tasks/scratch/scratch_writefile.cue b/tests/tasks/scratch/scratch_writefile.cue index b2432b17..9647a82a 100644 --- a/tests/tasks/scratch/scratch_writefile.cue +++ b/tests/tasks/scratch/scratch_writefile.cue @@ -2,17 +2,18 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - write: dagger.#WriteFile & { + write: core.#WriteFile & { input: dagger.#Scratch path: "/testing" contents: "1,2,3" permissions: 700 } - readfile: dagger.#ReadFile & { + readfile: core.#ReadFile & { input: write.output path: "/testing" } & { diff --git a/tests/tasks/source/source.cue b/tests/tasks/source/source.cue index 47b1cf44..f521a05f 100644 --- a/tests/tasks/source/source.cue +++ b/tests/tasks/source/source.cue @@ -2,19 +2,20 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - source: dagger.#Source & { + source: core.#Source & { path: "." } - exec: dagger.#Exec & { + exec: core.#Exec & { input: image.output mounts: code: { dest: "/src" @@ -24,7 +25,7 @@ dagger.#Plan & { } test: { - verifyHello: dagger.#ReadFile & { + verifyHello: core.#ReadFile & { input: source.output path: "/world.txt" } & { @@ -32,7 +33,7 @@ dagger.#Plan & { contents: "world\n" } - verifyWorld: dagger.#ReadFile & { + verifyWorld: core.#ReadFile & { input: exec.output path: "/test.txt" } & { diff --git a/tests/tasks/source/source_include_exclude.cue b/tests/tasks/source/source_include_exclude.cue index cf89d75f..fda47bc5 100644 --- a/tests/tasks/source/source_include_exclude.cue +++ b/tests/tasks/source/source_include_exclude.cue @@ -2,25 +2,26 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - sourceInclude: dagger.#Source & { + sourceInclude: core.#Source & { path: "." include: ["hello.txt"] } - sourceExclude: dagger.#Source & { + sourceExclude: core.#Source & { path: "." exclude: ["hello.txt"] } - test: dagger.#Exec & { + test: core.#Exec & { input: image.output mounts: { include: { diff --git a/tests/tasks/source/source_invalid_path.cue b/tests/tasks/source/source_invalid_path.cue index 539605f0..bdcf1cb5 100644 --- a/tests/tasks/source/source_invalid_path.cue +++ b/tests/tasks/source/source_invalid_path.cue @@ -2,15 +2,16 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - source: dagger.#Source & { + source: core.#Source & { path: "testdata/../.." } } diff --git a/tests/tasks/source/source_not_exist.cue b/tests/tasks/source/source_not_exist.cue index 2069f219..4241717f 100644 --- a/tests/tasks/source/source_not_exist.cue +++ b/tests/tasks/source/source_not_exist.cue @@ -1,15 +1,17 @@ package main import ( + "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - source: dagger.#Source & { + source: core.#Source & { path: "not/exist" } } diff --git a/tests/tasks/source/source_relative.cue b/tests/tasks/source/source_relative.cue index 3d88db14..e87260a1 100644 --- a/tests/tasks/source/source_relative.cue +++ b/tests/tasks/source/source_relative.cue @@ -2,19 +2,20 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - source: dagger.#Source & { + source: core.#Source & { path: "./testdata" } - verifyHello: dagger.#ReadFile & { + verifyHello: core.#ReadFile & { input: source.output path: "/world.txt" } & { diff --git a/tests/tasks/subdir/subdir_invalid_exec.cue b/tests/tasks/subdir/subdir_invalid_exec.cue index d2d85891..a2a059c6 100644 --- a/tests/tasks/subdir/subdir_invalid_exec.cue +++ b/tests/tasks/subdir/subdir_invalid_exec.cue @@ -2,32 +2,33 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - mkdir: dagger.#Mkdir & { + mkdir: core.#Mkdir & { input: image.output path: "/test/foo" } - writeChecker: dagger.#WriteFile & { + writeChecker: core.#WriteFile & { input: mkdir.output path: "/test/foo/hello" contents: "world" permissions: 0o700 } - subdir: dagger.#Subdir & { + subdir: core.#Subdir & { input: writeChecker.output path: "/test/foo" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: subdir.output args: [ "sh", "-c", diff --git a/tests/tasks/subdir/subdir_invalid_path.cue b/tests/tasks/subdir/subdir_invalid_path.cue index 99155973..bf0173ae 100644 --- a/tests/tasks/subdir/subdir_invalid_path.cue +++ b/tests/tasks/subdir/subdir_invalid_path.cue @@ -2,32 +2,33 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - mkdir: dagger.#Mkdir & { + mkdir: core.#Mkdir & { input: image.output path: "/test/foo" } - writeChecker: dagger.#WriteFile & { + writeChecker: core.#WriteFile & { input: mkdir.output path: "/test/foo/hello" contents: "world" permissions: 0o700 } - subdir: dagger.#Subdir & { + subdir: core.#Subdir & { input: writeChecker.output path: "/directorynotfound" } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output mounts: fs: { dest: "/target" diff --git a/tests/tasks/subdir/subdir_simple.cue b/tests/tasks/subdir/subdir_simple.cue index 7ad42239..731d202f 100644 --- a/tests/tasks/subdir/subdir_simple.cue +++ b/tests/tasks/subdir/subdir_simple.cue @@ -2,32 +2,33 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - mkdir: dagger.#Mkdir & { + mkdir: core.#Mkdir & { input: image.output path: "/test/foo" } - writeChecker: dagger.#WriteFile & { + writeChecker: core.#WriteFile & { input: mkdir.output path: "/test/foo/hello" contents: "world" permissions: 0o700 } - subdir: dagger.#Subdir & { + subdir: core.#Subdir & { input: writeChecker.output path: "/test/foo" } - verify: dagger.#ReadFile & { + verify: core.#ReadFile & { input: subdir.output path: "/hello" } & { diff --git a/tests/tasks/trimsecret/trimsecret.cue b/tests/tasks/trimsecret/trimsecret.cue index f4b02f9c..a309af8e 100644 --- a/tests/tasks/trimsecret/trimsecret.cue +++ b/tests/tasks/trimsecret/trimsecret.cue @@ -2,30 +2,31 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - image: dagger.#Pull & { + image: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - generate: dagger.#Exec & { + generate: core.#Exec & { input: image.output args: ["sh", "-c", "echo ' test ' > /secret"] } - load: dagger.#NewSecret & { + load: core.#NewSecret & { input: generate.output trimSpace: false path: "/secret" } - trim: dagger.#TrimSecret & { + trim: core.#TrimSecret & { input: load.output } - verify: dagger.#Exec & { + verify: core.#Exec & { input: image.output mounts: secret: { dest: "/run/secrets/test" diff --git a/tests/tasks/writefile/writefile.cue b/tests/tasks/writefile/writefile.cue index cfc2b67c..64925532 100644 --- a/tests/tasks/writefile/writefile.cue +++ b/tests/tasks/writefile/writefile.cue @@ -2,20 +2,21 @@ package main import ( "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - pull: dagger.#Pull & { + pull: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - write: dagger.#WriteFile & { + write: core.#WriteFile & { input: pull.output path: "/testing" contents: "1,2,3" permissions: 700 } - readfile: dagger.#ReadFile & { + readfile: core.#ReadFile & { input: write.output path: "/testing" } & { diff --git a/tests/tasks/writefile/writefile_failure_diff_contents.cue b/tests/tasks/writefile/writefile_failure_diff_contents.cue index 078da995..0a1f95be 100644 --- a/tests/tasks/writefile/writefile_failure_diff_contents.cue +++ b/tests/tasks/writefile/writefile_failure_diff_contents.cue @@ -1,20 +1,22 @@ package main import ( + "dagger.io/dagger" + "dagger.io/dagger/core" ) dagger.#Plan & { actions: { - pull: dagger.#Pull & { + pull: core.#Pull & { source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3" } - write: dagger.#WriteFile & { + write: core.#WriteFile & { input: pull.output path: "/testing" contents: "1,2,3,4" permissions: 700 } - readfile: dagger.#ReadFile & { + readfile: core.#ReadFile & { input: write.output path: "/testing" } & {