Merge dagger.io/dagger/engine into dagger.io/dagger
Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
@@ -3,7 +3,7 @@ package dagger
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"dagger.io/dagger/engine"
|
||||
dagger_0_2 "dagger.io/dagger"
|
||||
)
|
||||
|
||||
// An artifact such as source code checkout, container image, binary archive...
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
}
|
||||
|
||||
// Dagger stream. Can be mounted as a UNIX socket.
|
||||
#Stream: engine.#Service
|
||||
#Stream: dagger_0_2.#Service
|
||||
|
||||
// A reference to an external secret, for example:
|
||||
// - A password
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
// - An API token
|
||||
// Secrets are never merged in the Cue tree. They can only be used
|
||||
// by a special filesystem mount designed to minimize leak risk.
|
||||
#Secret: engine.#Secret
|
||||
#Secret: dagger_0_2.#Secret
|
||||
|
||||
#Input: {
|
||||
@dagger(input)
|
||||
|
@@ -1,41 +0,0 @@
|
||||
# Europa Core packages
|
||||
|
||||
## About this directory
|
||||
|
||||
`stdlib/europa/` holds the development version of the Core packages for the upcoming [Europa release](https://github.com/dagger/dagger/issues/1088).
|
||||
|
||||
Once Europa is released, `stdlib/europa` will become the new `stdlib/`
|
||||
|
||||
## What are Dagger core packages?
|
||||
|
||||
Dagger core packages are CUE packages released alongside the Dagger engine, to allow developers to access its features.
|
||||
|
||||
### Dagger Core API: `dagger.io/dagger`
|
||||
|
||||
*Development import path: `alpha.dagger.io/europa/dagger`*
|
||||
|
||||
The Dagger Core API defines core types and utilities for programming Dagger:
|
||||
|
||||
* `#Plan`: a complete configuration executable by `dagger up`
|
||||
* `#FS` to reference filesystem state
|
||||
* `#Secret` to (securely) reference external secrets
|
||||
* `#Service` to reference network service endpoints
|
||||
* `#Stream` to reference byte streams
|
||||
|
||||
### Low-level Engine API: `dagger.io/dagger/engine`
|
||||
|
||||
* *Development import path (implemented subset): `alpha.dagger.io/europa/dagger/engine`*
|
||||
* *Development import path (full spec): `alpha.dagger.io/dagger/europa/dagger/engine/spec/engine`*
|
||||
|
||||
`engine` is a low-level API for accessing the raw capabilities of the Dagger Engine. Most developers should use the Dagger Core API instead (`dagger.io/dagger`), but experts and framework developers can target the engine API directly for maximum control.
|
||||
|
||||
This API prioritizes robustness, consistency, and feature completeness. It does NOT prioritize developer convenience or leveraging Cue for composition.
|
||||
|
||||
In Europa, `engine` will deprecate the following implicit API:
|
||||
* Low-level operations defined in `alpha.dagger.io/dagger/op`
|
||||
* Imperative DSL to assemble Dockerfile-like arrays as Cue arrays
|
||||
* Convention to embed pipelines in the Cue lattice with the special nested definition `#up`
|
||||
* Convention to reference filesystem state from the Cue lattice with `@dagger(artifact)`
|
||||
* Convention to reference external secrets from the Cue lattice with `@dagger(secret)`
|
||||
* Convention to reference external network endpoints from the Cue lattice with `@dagger(stream)`
|
||||
* Convention that some operations (specifically `op.#Local`) are meant to be generated at runtime rather than authored manually.
|
1
pkg/dagger.io/README.md
Symbolic link
1
pkg/dagger.io/README.md
Symbolic link
@@ -0,0 +1 @@
|
||||
../../docs/learn/1213-api.md
|
@@ -1,156 +0,0 @@
|
||||
package engine
|
||||
|
||||
// A special kind of program which `dagger` can execute.
|
||||
#Plan: {
|
||||
// Receive inputs from the client
|
||||
inputs: {
|
||||
// Receive directories
|
||||
directories: [name=string]: _#inputDirectory
|
||||
// Securely receive secrets
|
||||
secrets: [name=string]: _#inputSecret
|
||||
// Receive runtime parameters
|
||||
params: [name=string]: _
|
||||
}
|
||||
|
||||
// Send outputs to the client
|
||||
outputs: {
|
||||
// Export an #FS to the client
|
||||
directories: [name=string]: _#outputDirectory
|
||||
// Export a string to a file
|
||||
files: [name=string]: _#outputFile
|
||||
}
|
||||
|
||||
// Forward network services to and from the client
|
||||
proxy: [endpoint=string]: _#proxyEndpoint
|
||||
|
||||
// Configure platform execution
|
||||
platform?: string
|
||||
|
||||
// Execute actions in containers
|
||||
actions: {
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
_#inputDirectory: {
|
||||
// FIXME: rename to "InputDirectory" for consistency
|
||||
$dagger: task: _name: "InputDirectory"
|
||||
|
||||
// Import from this path ON THE CLIENT MACHINE
|
||||
// Example: "/Users/Alice/dev/todoapp/src"
|
||||
path: string
|
||||
|
||||
// Filename patterns to include
|
||||
// Example: ["*.go", "Dockerfile"]
|
||||
include?: [...string]
|
||||
|
||||
// Filename patterns to exclude
|
||||
// Example: ["node_modules"]
|
||||
exclude?: [...string]
|
||||
|
||||
// Imported filesystem contents
|
||||
// Use this as input for actions requiring an #FS field
|
||||
contents: #FS
|
||||
}
|
||||
|
||||
// Securely receive a secret from the client
|
||||
_#inputSecret: {
|
||||
_#inputSecretEnv | _#inputSecretFile | _#inputSecretExec
|
||||
|
||||
// Reference to the secret contents
|
||||
// Use this by securely mounting it into a container.
|
||||
// See universe.dagger.io/docker.#Run.mounts
|
||||
// FIXME: `contents` field name causes confusion (not actually the secret contents..)
|
||||
contents: #Secret
|
||||
|
||||
// Whether to trim leading and trailing space characters from secret value
|
||||
trimSpace: *true | false
|
||||
}
|
||||
|
||||
// Read secret from an environment variable ON THE CLIENT MACHINE
|
||||
_#inputSecretEnv: {
|
||||
$dagger: task: _name: "InputSecretEnv"
|
||||
|
||||
envvar: string
|
||||
|
||||
contents: #Secret
|
||||
}
|
||||
|
||||
// Read secret from a file ON THE CLIENT MACHINE
|
||||
_#inputSecretFile: {
|
||||
$dagger: task: _name: "InputSecretFile"
|
||||
|
||||
path: string
|
||||
|
||||
contents: #Secret
|
||||
}
|
||||
|
||||
// Get secret by executing a command ON THE CLIENT MACHINE
|
||||
_#inputSecretExec: {
|
||||
$dagger: task: _name: "InputSecretExec"
|
||||
|
||||
command: {
|
||||
name: string
|
||||
args: [...string]
|
||||
interactive: true | *false @dagger(notimplemented) // FIXME: https://github.com/dagger/dagger/issues/1268
|
||||
}
|
||||
|
||||
contents: #Secret
|
||||
}
|
||||
|
||||
_#outputDirectory: {
|
||||
$dagger: task: _name: "OutputDirectory"
|
||||
|
||||
// Filesystem contents to export
|
||||
// Reference an #FS field produced by an action
|
||||
contents: #FS
|
||||
|
||||
// Export to this path ON THE CLIENT MACHINE
|
||||
dest: string
|
||||
}
|
||||
|
||||
_#outputFile: {
|
||||
$dagger: task: _name: "OutputFile"
|
||||
|
||||
// File contents to export
|
||||
contents: string
|
||||
|
||||
// Export to this path ON THE CLIENT MACHINE
|
||||
dest: string
|
||||
|
||||
// Permissions of the file (defaults to 0o644)
|
||||
permissions?: int
|
||||
}
|
||||
|
||||
// Forward a network endpoint to and from the client
|
||||
_#proxyEndpoint: {
|
||||
$dagger: task: _name: "ProxyEndpoint"
|
||||
|
||||
// Service endpoint can be proxied to action containers as unix sockets
|
||||
// FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
|
||||
// FIXME: should be endpoint
|
||||
service: #Service
|
||||
endpoint: service
|
||||
{
|
||||
// FIXME: reconcile with spec
|
||||
unix: string
|
||||
} | {
|
||||
// FIXME: reconcile with spec
|
||||
npipe: string
|
||||
} | {
|
||||
// Listen for connections ON THE CLIENT MACHINE, proxy to actions
|
||||
listen: #Address @dagger(notimplemented)
|
||||
} | {
|
||||
// Connect to a remote endpoint FROM THE CLIENT MACHINE, proxy to actions
|
||||
connect: #Address @dagger(notimplemented)
|
||||
} | {
|
||||
// Proxy to/from the contents of a file ON THE CLIENT MACHINE
|
||||
filepath: string @dagger(notimplemented)
|
||||
} | {
|
||||
// Proxy to/from standard input and output of a command ON THE CLIENT MACHINE
|
||||
command: [string, ...string] | string @dagger(notimplemented)
|
||||
}
|
||||
}
|
||||
|
||||
// A network service address
|
||||
#Address: string & =~"^(tcp://|unix://|udp://).*"
|
@@ -1,45 +0,0 @@
|
||||
package engine
|
||||
|
||||
// Create a new a secret from a filesystem tree
|
||||
#NewSecret: {
|
||||
$dagger: task: _name: "NewSecret"
|
||||
|
||||
// Filesystem tree holding the secret
|
||||
input: #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
|
||||
}
|
||||
|
||||
// Securely apply a CUE transformation on the contents of a secret
|
||||
// FIXME: disabled due to data race associated with filling #function.input
|
||||
// #TransformSecret: {
|
||||
// $dagger: task: _name: "TransformSecret"
|
||||
// // The original secret
|
||||
// input: #Secret
|
||||
// // A new secret or (map of secrets) with the transformation applied
|
||||
// output: #Secret | {[string]: output}
|
||||
// // Transformation function
|
||||
// #function: {
|
||||
// // Full contents of the input secret (only available to the function)
|
||||
// input: string
|
||||
// _functionOutput: string | {[string]: _functionOutput}
|
||||
// // New contents of the output secret (must provided by the caller)
|
||||
// output: _functionOutput
|
||||
// }
|
||||
// }
|
||||
|
||||
#DecodeSecret: {
|
||||
$dagger: task: _name: "DecodeSecret"
|
||||
|
||||
// A #Secret whose plain text is a JSON or YAML string
|
||||
input: #Secret
|
||||
|
||||
format: "json" | "yaml"
|
||||
|
||||
// A new secret or (map of secrets) derived from unmarshaling the input secret's plain text
|
||||
output: #Secret | {[string]: output}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
package engine
|
||||
|
||||
// A reference to a filesystem tree.
|
||||
// For example:
|
||||
// - The root filesystem of a container
|
||||
// - A source code repository
|
||||
// - A directory containing binary artifacts
|
||||
// Rule of thumb: if it fits in a tar archive, it fits in a #FS.
|
||||
#FS: {
|
||||
$dagger: fs: _id: string | null
|
||||
}
|
||||
|
||||
// A reference to an external secret, for example:
|
||||
// - A password
|
||||
// - A SSH private key
|
||||
// - An API token
|
||||
// Secrets are never merged in the Cue tree. They can only be used
|
||||
// by a special filesystem mount designed to minimize leak risk.
|
||||
#Secret: {
|
||||
$dagger: secret: _id: string
|
||||
}
|
||||
|
||||
// A reference to a network service endpoint, for example:
|
||||
// - A TCP or UDP port
|
||||
// - A unix or npipe socket
|
||||
// - An HTTPS endpoint
|
||||
#Service: {
|
||||
$dagger: service: _id: string
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package engine
|
||||
package dagger
|
||||
|
||||
// Execute a command in a container
|
||||
#Exec: {
|
@@ -1,4 +1,4 @@
|
||||
package engine
|
||||
package dagger
|
||||
|
||||
// Access the source directory for the current CUE package
|
||||
// This may safely be called from any package
|
||||
@@ -63,9 +63,6 @@ package engine
|
||||
output: #FS
|
||||
}
|
||||
|
||||
// Produce an empty directory
|
||||
#Scratch: #FS & {$dagger: fs: _id: null}
|
||||
|
||||
// Copy files from one FS tree to another
|
||||
#Copy: {
|
||||
$dagger: task: _name: "Copy"
|
||||
@@ -98,3 +95,24 @@ package engine
|
||||
layers: [...#CopyInfo]
|
||||
output: #FS
|
||||
}
|
||||
|
||||
// Select a subdirectory from a filesystem tree
|
||||
#Subdir: {
|
||||
// Input tree
|
||||
input: #FS
|
||||
|
||||
// Path of the subdirectory
|
||||
// Example: "/build"
|
||||
path: string
|
||||
|
||||
// Copy action
|
||||
_copy: #Copy & {
|
||||
"input": #Scratch
|
||||
contents: input
|
||||
source: path
|
||||
dest: "/"
|
||||
}
|
||||
|
||||
// Subdirectory tree
|
||||
output: #FS & _copy.output
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package engine
|
||||
package dagger
|
||||
|
||||
// Push a directory to a git remote
|
||||
#GitPush: {
|
@@ -1,4 +1,4 @@
|
||||
package engine
|
||||
package dagger
|
||||
|
||||
// HTTP operations
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package engine
|
||||
package dagger
|
||||
|
||||
import (
|
||||
"list"
|
@@ -1,8 +1,153 @@
|
||||
package dagger
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// A special kind of program which `dagger` can execute.
|
||||
#Plan: engine.#Plan
|
||||
#Plan: {
|
||||
// Receive inputs from the client
|
||||
inputs: {
|
||||
// Receive directories
|
||||
directories: [name=string]: _#inputDirectory
|
||||
// Securely receive secrets
|
||||
secrets: [name=string]: _#inputSecret
|
||||
// Receive runtime parameters
|
||||
params: [name=string]: _
|
||||
}
|
||||
|
||||
// Send outputs to the client
|
||||
outputs: {
|
||||
// Export an #FS to the client
|
||||
directories: [name=string]: _#outputDirectory
|
||||
// Export a string to a file
|
||||
files: [name=string]: _#outputFile
|
||||
}
|
||||
|
||||
// Forward network services to and from the client
|
||||
proxy: [endpoint=string]: _#proxyEndpoint
|
||||
|
||||
// Configure platform execution
|
||||
platform?: string
|
||||
|
||||
// Execute actions in containers
|
||||
actions: {
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
_#inputDirectory: {
|
||||
// FIXME: rename to "InputDirectory" for consistency
|
||||
$dagger: task: _name: "InputDirectory"
|
||||
|
||||
// Import from this path ON THE CLIENT MACHINE
|
||||
// Example: "/Users/Alice/dev/todoapp/src"
|
||||
path: string
|
||||
|
||||
// Filename patterns to include
|
||||
// Example: ["*.go", "Dockerfile"]
|
||||
include?: [...string]
|
||||
|
||||
// Filename patterns to exclude
|
||||
// Example: ["node_modules"]
|
||||
exclude?: [...string]
|
||||
|
||||
// Imported filesystem contents
|
||||
// Use this as input for actions requiring an #FS field
|
||||
contents: #FS
|
||||
}
|
||||
|
||||
// Securely receive a secret from the client
|
||||
_#inputSecret: {
|
||||
_#inputSecretEnv | _#inputSecretFile | _#inputSecretExec
|
||||
|
||||
// Reference to the secret contents
|
||||
// Use this by securely mounting it into a container.
|
||||
// See universe.io/docker.#Run.mounts
|
||||
// FIXME: `contents` field name causes confusion (not actually the secret contents..)
|
||||
contents: #Secret
|
||||
|
||||
// Whether to trim leading and trailing space characters from secret value
|
||||
trimSpace: *true | false
|
||||
}
|
||||
|
||||
// Read secret from an environment variable ON THE CLIENT MACHINE
|
||||
_#inputSecretEnv: {
|
||||
$dagger: task: _name: "InputSecretEnv"
|
||||
|
||||
envvar: string
|
||||
|
||||
contents: #Secret
|
||||
}
|
||||
|
||||
// Read secret from a file ON THE CLIENT MACHINE
|
||||
_#inputSecretFile: {
|
||||
$dagger: task: _name: "InputSecretFile"
|
||||
|
||||
path: string
|
||||
|
||||
contents: #Secret
|
||||
}
|
||||
|
||||
// Get secret by executing a command ON THE CLIENT MACHINE
|
||||
_#inputSecretExec: {
|
||||
$dagger: task: _name: "InputSecretExec"
|
||||
|
||||
command: {
|
||||
name: string
|
||||
args: [...string]
|
||||
interactive: true | *false @dagger(notimplemented) // FIXME: https://github.com/dagger/dagger/issues/1268
|
||||
}
|
||||
|
||||
contents: #Secret
|
||||
}
|
||||
|
||||
_#outputDirectory: {
|
||||
$dagger: task: _name: "OutputDirectory"
|
||||
|
||||
// Filesystem contents to export
|
||||
// Reference an #FS field produced by an action
|
||||
contents: #FS
|
||||
|
||||
// Export to this path ON THE CLIENT MACHINE
|
||||
dest: string
|
||||
}
|
||||
|
||||
_#outputFile: {
|
||||
$dagger: task: _name: "OutputFile"
|
||||
|
||||
// File contents to export
|
||||
contents: string
|
||||
|
||||
// Export to this path ON THE CLIENT MACHINE
|
||||
dest: string
|
||||
|
||||
// Permissions of the file (defaults to 0o644)
|
||||
permissions?: int
|
||||
}
|
||||
|
||||
// Forward a network endpoint to and from the client
|
||||
_#proxyEndpoint: {
|
||||
$dagger: task: _name: "ProxyEndpoint"
|
||||
|
||||
// Service endpoint can be proxied to action containers as unix sockets
|
||||
// FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
|
||||
// FIXME: should be endpoint
|
||||
service: #Service
|
||||
endpoint: service
|
||||
{
|
||||
// FIXME: reconcile with spec
|
||||
unix: string
|
||||
} | {
|
||||
// FIXME: reconcile with spec
|
||||
npipe: string
|
||||
} | {
|
||||
// Listen for connections ON THE CLIENT MACHINE, proxy to actions
|
||||
listen: #Address @dagger(notimplemented)
|
||||
} | {
|
||||
// Connect to a remote endpoint FROM THE CLIENT MACHINE, proxy to actions
|
||||
connect: #Address @dagger(notimplemented)
|
||||
} | {
|
||||
// Proxy to/from the contents of a file ON THE CLIENT MACHINE
|
||||
filepath: string @dagger(notimplemented)
|
||||
} | {
|
||||
// Proxy to/from standard input and output of a command ON THE CLIENT MACHINE
|
||||
command: [string, ...string] | string @dagger(notimplemented)
|
||||
}
|
||||
}
|
||||
|
29
pkg/dagger.io/dagger/secrets.cue
Normal file
29
pkg/dagger.io/dagger/secrets.cue
Normal file
@@ -0,0 +1,29 @@
|
||||
package 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
|
||||
|
||||
format: "json" | "yaml"
|
||||
|
||||
// A new secret or (map of secrets) derived from unmarshaling the input secret's plain text
|
||||
output: #Secret | {[string]: output}
|
||||
}
|
||||
|
||||
// Create a new a secret from a filesystem tree
|
||||
#NewSecret: {
|
||||
$dagger: task: _name: "NewSecret"
|
||||
|
||||
// Filesystem tree holding the secret
|
||||
input: #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
|
||||
}
|
@@ -1,16 +1,19 @@
|
||||
package dagger
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// A reference to a filesystem tree.
|
||||
// For example:
|
||||
// - The root filesystem of a container
|
||||
// - A source code repository
|
||||
// - A directory containing binary artifacts
|
||||
// Rule of thumb: if it fits in a tar archive, it fits in a #FS.
|
||||
#FS: engine.#FS
|
||||
#FS: {
|
||||
$dagger: fs: _id: string | null
|
||||
}
|
||||
|
||||
// An empty directory
|
||||
#Scratch: #FS & {
|
||||
$dagger: fs: _id: null
|
||||
}
|
||||
|
||||
// A reference to an external secret, for example:
|
||||
// - A password
|
||||
@@ -18,13 +21,17 @@ import (
|
||||
// - An API token
|
||||
// Secrets are never merged in the Cue tree. They can only be used
|
||||
// by a special filesystem mount designed to minimize leak risk.
|
||||
#Secret: engine.#Secret
|
||||
#Secret: {
|
||||
$dagger: secret: _id: string
|
||||
}
|
||||
|
||||
// A reference to a network service endpoint, for example:
|
||||
// - A TCP or UDP port
|
||||
// - A unix socket
|
||||
// - An HTTPS endpoint
|
||||
#Service: engine.#Service
|
||||
#Service: {
|
||||
$dagger: service: _id: string
|
||||
}
|
||||
|
||||
// A network service address
|
||||
#Address: engine.#Address
|
||||
#Address: string & =~"^(tcp://|unix://|udp://).*"
|
||||
|
@@ -1,61 +0,0 @@
|
||||
package dagger
|
||||
|
||||
import (
|
||||
// "encoding/json"
|
||||
// "encoding/yaml"
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// Access the source directory for the current CUE package
|
||||
// This may safely be called from any package
|
||||
#Source: engine.#Source
|
||||
|
||||
// A (best effort) persistent cache dir
|
||||
#CacheDir: engine.#CacheDir
|
||||
|
||||
// A temporary directory for command execution
|
||||
#TempDir: engine.#TempDir
|
||||
|
||||
// Select a subdirectory from a filesystem tree
|
||||
#Subdir: {
|
||||
// Input tree
|
||||
input: engine.#FS
|
||||
|
||||
// Path of the subdirectory
|
||||
// Example: "/build"
|
||||
path: string
|
||||
|
||||
// Copy action
|
||||
_copy: engine.#Copy & {
|
||||
"input": engine.#Scratch
|
||||
contents: input
|
||||
source: path
|
||||
dest: "/"
|
||||
}
|
||||
|
||||
// Subdirectory tree
|
||||
output: engine.#FS & _copy.output
|
||||
}
|
||||
|
||||
// DecodeSecret is a convenience wrapper around #TransformSecret. The plain text contents of input is expected to match the format
|
||||
// #DecodeSecret: {
|
||||
// {
|
||||
// format: "json"
|
||||
// engine.#TransformSecret & {
|
||||
// #function: {
|
||||
// input: _
|
||||
// output: json.Unmarshal(input)
|
||||
// }
|
||||
// }
|
||||
// } | {
|
||||
// format: "yaml"
|
||||
// engine.#TransformSecret & {
|
||||
// #function: {
|
||||
// input: _
|
||||
// output: yaml.Unmarshal(input)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
#DecodeSecret: engine.#DecodeSecret
|
@@ -32,7 +32,7 @@ var (
|
||||
UniverseModule,
|
||||
}
|
||||
|
||||
EnginePackage = fmt.Sprintf("%s/dagger/engine", DaggerModule)
|
||||
DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule)
|
||||
|
||||
lockFilePath = "dagger.lock"
|
||||
)
|
||||
|
@@ -2,7 +2,6 @@ package alpine
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/docker"
|
||||
@@ -17,7 +16,7 @@ dagger.#Plan & {
|
||||
version: "3.10.9"
|
||||
}
|
||||
|
||||
verify: engine.#Readfile & {
|
||||
verify: dagger.#Readfile & {
|
||||
input: build.output.rootfs
|
||||
path: "/etc/alpine-release"
|
||||
contents: "3.10.9\n"
|
||||
|
@@ -3,7 +3,6 @@ package bash
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
@@ -27,8 +26,8 @@ import (
|
||||
contents: string
|
||||
|
||||
_filename: "run.sh"
|
||||
_write: engine.#WriteFile & {
|
||||
input: engine.#Scratch
|
||||
_write: dagger.#WriteFile & {
|
||||
input: dagger.#Scratch
|
||||
path: _filename
|
||||
"contents": contents
|
||||
}
|
||||
|
@@ -1 +0,0 @@
|
||||
../../../dagger.io
|
@@ -2,7 +2,6 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// Modular build API for Docker containers
|
||||
@@ -47,7 +46,7 @@ import (
|
||||
dest: string | *"/"
|
||||
|
||||
// Execute copy operation
|
||||
_copy: engine.#Copy & {
|
||||
_copy: dagger.#Copy & {
|
||||
"input": input.rootfs
|
||||
"contents": contents
|
||||
"source": source
|
||||
|
@@ -2,7 +2,6 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// A container image
|
||||
@@ -11,7 +10,7 @@ import (
|
||||
rootfs: dagger.#FS
|
||||
|
||||
// Image config
|
||||
config: engine.#ImageConfig
|
||||
config: dagger.#ImageConfig
|
||||
}
|
||||
|
||||
// A ref is an address for a remote container image
|
||||
@@ -21,4 +20,4 @@ import (
|
||||
// - "index.docker.io/dagger:latest"
|
||||
// - "index.docker.io/dagger:latest@sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe"
|
||||
// FIXME: add formatting constraints
|
||||
#Ref: engine.#Ref
|
||||
#Ref: dagger.#Ref
|
||||
|
@@ -2,7 +2,6 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/engine"
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
@@ -17,7 +16,7 @@ import (
|
||||
secret: dagger.#Secret
|
||||
}
|
||||
|
||||
_op: engine.#Pull & {
|
||||
_op: dagger.#Pull & {
|
||||
"source": source
|
||||
if auth != _|_ {
|
||||
"auth": auth
|
||||
|
@@ -2,7 +2,6 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// Upload an image to a remote repository
|
||||
@@ -22,7 +21,7 @@ import (
|
||||
// Image to push
|
||||
image: #Image
|
||||
|
||||
_push: engine.#Push & {
|
||||
_push: dagger.#Push & {
|
||||
"dest": dest
|
||||
if auth != _|_ {
|
||||
"auth": auth
|
||||
|
@@ -4,7 +4,6 @@ import (
|
||||
"list"
|
||||
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// Run a command in a container
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
always: bool | *false
|
||||
|
||||
// Filesystem mounts
|
||||
mounts: [name=string]: engine.#Mount
|
||||
mounts: [name=string]: dagger.#Mount
|
||||
|
||||
// Expose network ports
|
||||
// FIXME: investigate feasibility
|
||||
@@ -55,7 +54,7 @@ import (
|
||||
|
||||
// Environment variables
|
||||
// Example: {"DEBUG": "1"}
|
||||
env: [string]: string | engine.#Secret
|
||||
env: [string]: string | dagger.#Secret
|
||||
|
||||
// Working directory for the command
|
||||
// Example: "/src"
|
||||
@@ -87,7 +86,7 @@ import (
|
||||
rootfs: dagger.#FS & _exec.output
|
||||
files: [path=string]: {
|
||||
contents: string & _read.contents
|
||||
_read: engine.#ReadFile & {
|
||||
_read: dagger.#ReadFile & {
|
||||
input: _exec.output
|
||||
"path": path
|
||||
}
|
||||
@@ -109,7 +108,7 @@ import (
|
||||
}
|
||||
|
||||
// Actually execute the command
|
||||
_exec: engine.#Exec & {
|
||||
_exec: dagger.#Exec & {
|
||||
"input": input.rootfs
|
||||
"always": always
|
||||
"mounts": mounts
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/engine"
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
// Change image config
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
input: #Image
|
||||
|
||||
// The image config to change
|
||||
config: engine.#ImageConfig
|
||||
config: dagger.#ImageConfig
|
||||
|
||||
_set: engine.#Set & {
|
||||
_set: dagger.#Set & {
|
||||
"input": input.config
|
||||
"config": config
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/docker"
|
||||
@@ -27,7 +26,7 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: engine.#ReadFile & {
|
||||
verify: dagger.#ReadFile & {
|
||||
input: image.output.rootfs
|
||||
path: "/test.txt"
|
||||
}
|
||||
@@ -60,7 +59,7 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: engine.#ReadFile & {
|
||||
verify: dagger.#ReadFile & {
|
||||
input: image.output.rootfs
|
||||
path: "/test.txt"
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
@@ -13,7 +12,7 @@ dagger.#Plan & {
|
||||
// Test: change image config with docker.#Set
|
||||
set: {
|
||||
image: output: docker.#Image & {
|
||||
rootfs: engine.#Scratch
|
||||
rootfs: dagger.#Scratch
|
||||
config: {
|
||||
cmd: ["/bin/sh"]
|
||||
env: PATH: "/sbin:/bin"
|
||||
@@ -44,8 +43,8 @@ dagger.#Plan & {
|
||||
|
||||
// Test: image config behavior is correct
|
||||
config: {
|
||||
build: engine.#Dockerfile & {
|
||||
source: engine.#Scratch
|
||||
build: dagger.#Dockerfile & {
|
||||
source: dagger.#Scratch
|
||||
dockerfile: contents: """
|
||||
FROM alpine:3.15.0
|
||||
RUN echo -n 'not hello from dagger' > /dagger.txt
|
||||
|
@@ -2,7 +2,6 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/alpine"
|
||||
@@ -25,7 +24,7 @@ dagger.#Plan & {
|
||||
}
|
||||
}
|
||||
|
||||
verify: engine.#ReadFile & {
|
||||
verify: dagger.#ReadFile & {
|
||||
input: run.output.rootfs
|
||||
path: "/output.txt"
|
||||
}
|
||||
@@ -61,7 +60,7 @@ dagger.#Plan & {
|
||||
export: directories: "/test": _
|
||||
}
|
||||
|
||||
verify: engine.#ReadFile & {
|
||||
verify: dagger.#ReadFile & {
|
||||
input: run.export.directories."/test".contents
|
||||
path: "/output.txt"
|
||||
}
|
||||
|
@@ -1,12 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
runtime_image_ref: string | *"thechangelog/runtime:2021-05-29T10.17.12Z"
|
||||
|
||||
engine.#Plan & {
|
||||
dagger.#Plan & {
|
||||
inputs: directories: app: {
|
||||
path: "."
|
||||
exclude: [
|
||||
@@ -57,11 +56,11 @@ engine.#Plan & {
|
||||
}
|
||||
|
||||
actions: {
|
||||
runtimeImage: engine.#Pull & {
|
||||
runtimeImage: dagger.#Pull & {
|
||||
source: runtime_image_ref
|
||||
}
|
||||
|
||||
depsCache: engine.#CacheDir & {
|
||||
depsCache: dagger.#CacheDir & {
|
||||
id: "depsCache"
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ engine.#Plan & {
|
||||
contents: depsCache
|
||||
}
|
||||
|
||||
buildCacheTest: engine.#CacheDir & {
|
||||
buildCacheTest: dagger.#CacheDir & {
|
||||
id: "buildCacheTest"
|
||||
}
|
||||
|
||||
@@ -79,7 +78,7 @@ engine.#Plan & {
|
||||
contents: buildCacheTest
|
||||
}
|
||||
|
||||
buildCacheProd: engine.#CacheDir & {
|
||||
buildCacheProd: dagger.#CacheDir & {
|
||||
id: "buildCacheProd"
|
||||
}
|
||||
|
||||
@@ -88,7 +87,7 @@ engine.#Plan & {
|
||||
contents: buildCacheProd
|
||||
}
|
||||
|
||||
nodeModulesCache: engine.#CacheDir & {
|
||||
nodeModulesCache: dagger.#CacheDir & {
|
||||
id: "nodeModulesCache"
|
||||
}
|
||||
|
||||
@@ -97,20 +96,20 @@ engine.#Plan & {
|
||||
contents: nodeModulesCache
|
||||
}
|
||||
|
||||
appImage: engine.#Copy & {
|
||||
appImage: dagger.#Copy & {
|
||||
input: runtimeImage.output
|
||||
contents: inputs.directories.app.contents
|
||||
dest: "/app"
|
||||
}
|
||||
|
||||
deps: engine.#Exec & {
|
||||
deps: dagger.#Exec & {
|
||||
input: appImage.output
|
||||
mounts: depsCacheMount
|
||||
workdir: "/app"
|
||||
args: ["bash", "-c", " mix deps.get"]
|
||||
}
|
||||
|
||||
assetsCompile: engine.#Exec & {
|
||||
assetsCompile: dagger.#Exec & {
|
||||
input: depsCompileProd.output
|
||||
mounts: depsCacheMount & nodeModulesCacheMount
|
||||
workdir: "/app/assets"
|
||||
@@ -118,7 +117,7 @@ engine.#Plan & {
|
||||
args: ["bash", "-c", "yarn install --frozen-lockfile && yarn run compile"]
|
||||
}
|
||||
|
||||
#depsCompile: engine.#Exec & {
|
||||
#depsCompile: dagger.#Exec & {
|
||||
input: deps.output
|
||||
mounts: depsCacheMount
|
||||
workdir: "/app"
|
||||
@@ -135,7 +134,7 @@ engine.#Plan & {
|
||||
mounts: buildCacheProdMount
|
||||
}
|
||||
|
||||
assetsDigest: engine.#Exec & {
|
||||
assetsDigest: dagger.#Exec & {
|
||||
input: assetsCompile.output
|
||||
mounts: depsCacheMount & buildCacheProdMount & nodeModulesCacheMount
|
||||
env: MIX_ENV: "prod"
|
||||
@@ -143,20 +142,20 @@ engine.#Plan & {
|
||||
args: ["bash", "-c", "mix phx.digest"]
|
||||
}
|
||||
|
||||
imageProdCacheCopy: engine.#Exec & {
|
||||
imageProdCacheCopy: dagger.#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: engine.#Copy & {
|
||||
imageProdDockerCopy: dagger.#Copy & {
|
||||
input: imageProdCacheCopy.output
|
||||
source: root: inputs.directories.docker.contents
|
||||
dest: "/"
|
||||
}
|
||||
|
||||
imageProd: engine.#Build & {
|
||||
imageProd: dagger.#Build & {
|
||||
source: imageProdDockerCopy.output
|
||||
dockerfile: path: "/docker/Dockerfile.production"
|
||||
buildArg: {
|
||||
|
@@ -19,7 +19,7 @@ actions: {
|
||||
// workdir: _
|
||||
// // FIXME: remove copy-pasta
|
||||
// mounts: nodeModules: {
|
||||
// contents: engine.#CacheDir & {
|
||||
// contents: dagger.#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: engine.#CacheDir & {
|
||||
// contents: dagger.#CacheDir & {
|
||||
// // FIXME: do we need an ID here?
|
||||
// id: "\(mix.app)_assets_node_modules"
|
||||
// // FIXME: will there be multiple writers?
|
||||
|
@@ -2,7 +2,6 @@ package mix
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
@@ -68,7 +67,7 @@ import (
|
||||
}
|
||||
if cache.deps != null {
|
||||
mounts: deps: {
|
||||
contents: engine.#CacheDir & {
|
||||
contents: dagger.#CacheDir & {
|
||||
id: "\(app.name)_deps"
|
||||
concurrency: cache.deps
|
||||
}
|
||||
@@ -77,7 +76,7 @@ import (
|
||||
}
|
||||
if cache.build != null {
|
||||
mounts: buildCache: {
|
||||
contents: engine.#CacheDir & {
|
||||
contents: dagger.#CacheDir & {
|
||||
id: "\(app.name)_build_\(env)"
|
||||
concurrency: cache.build
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
#Pull: engine.#GitPull
|
||||
#Push: engine.#GitPush
|
||||
#Pull: dagger.#GitPull
|
||||
#Push: dagger.#GitPush
|
||||
|
@@ -4,7 +4,6 @@ package netlify
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/docker"
|
||||
@@ -61,7 +60,7 @@ import (
|
||||
container: bash.#Run & {
|
||||
input: *_build.output | docker.#Image
|
||||
script: {
|
||||
_load: engine.#Source & {
|
||||
_load: dagger.#Source & {
|
||||
path: "."
|
||||
include: ["*.sh"]
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ package netlify
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/netlify"
|
||||
@@ -29,8 +28,8 @@ dagger.#Plan & {
|
||||
|
||||
marker: "hello world"
|
||||
|
||||
data: engine.#WriteFile & {
|
||||
input: engine.#Scratch
|
||||
data: dagger.#WriteFile & {
|
||||
input: dagger.#Scratch
|
||||
path: "index.html"
|
||||
contents: marker
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ package yarn
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/yarn"
|
||||
@@ -79,7 +78,7 @@ dagger.#Plan & {
|
||||
path: string
|
||||
contents: string
|
||||
|
||||
_read: engine.#ReadFile & {
|
||||
_read: dagger.#ReadFile & {
|
||||
"input": input
|
||||
"path": path
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/bash"
|
||||
@@ -77,7 +76,7 @@ import (
|
||||
mounts: {
|
||||
"yarn cache": {
|
||||
dest: "/cache/yarn"
|
||||
contents: engine.#CacheDir & {
|
||||
contents: dagger.#CacheDir & {
|
||||
// FIXME: are there character limitations in cache ID?
|
||||
id: "universe.dagger.io/yarn.#Build \(name)"
|
||||
}
|
||||
|
Reference in New Issue
Block a user