Resolve spec merge conflicts

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2021-12-19 09:39:52 +00:00 committed by Solomon Hykes
parent 087b36b2a6
commit 7b7ee5455f
21 changed files with 463 additions and 303 deletions

View File

@ -20,9 +20,7 @@
- [docker](./docker/README.md) - Docker container operations - [docker](./docker/README.md) - Docker container operations
- [docker/compose](./docker/compose.md) - Docker-compose operations - [docker/compose](./docker/compose.md) - Docker-compose operations
- [europa/dagger](./europa/dagger/README.md) - - - [europa/dagger](./europa/dagger/README.md) - -
- [europa/dagger/engine](./europa/dagger/engine/README.md) - - - [europa/dagger/engine](./europa/dagger/engine.md) - -
- [europa/dagger/engine/spec](./europa/dagger/engine/spec/README.md) - Placeholder package, to keep docs generating tool happy.
- [europa/dagger/engine/spec/engine](./europa/dagger/engine/spec/engine.md) - The Dagger API.
- [gcp](./gcp/README.md) - Google Cloud Platform - [gcp](./gcp/README.md) - Google Cloud Platform
- [gcp/cloudrun](./gcp/cloudrun.md) - - - [gcp/cloudrun](./gcp/cloudrun.md) - -
- [gcp/gcr](./gcp/gcr.md) - Google Container Registry - [gcp/gcr](./gcp/gcr.md) - Google Container Registry

View File

@ -0,0 +1,283 @@
---
sidebar_label: engine
---
# alpha.dagger.io/europa/dagger/engine
```cue
import "alpha.dagger.io/europa/dagger/engine"
```
## engine.#Build
Build a container image using buildkit
### engine.#Build Inputs
_No input._
### engine.#Build Outputs
_No output._
## engine.#CacheDir
A (best effort) persistent cache dir
### engine.#CacheDir Inputs
_No input._
### engine.#CacheDir Outputs
_No output._
## engine.#Copy
Copy files from one FS tree to another
### engine.#Copy Inputs
_No input._
### engine.#Copy Outputs
_No output._
## engine.#CopyInfo
### engine.#CopyInfo Inputs
_No input._
### engine.#CopyInfo Outputs
_No output._
## engine.#DAG
A special kind of program which `dagger` can execute.
### engine.#DAG Inputs
_No input._
### engine.#DAG Outputs
_No output._
## engine.#Exec
Execute a command in a container
### engine.#Exec Inputs
_No input._
### engine.#Exec Outputs
_No output._
## engine.#FS
A reference to a filesystem tree. For example: - The root filesystem of a container - A source code repository - A directory containing binary artifacts Rule of thumb: if it fits in a tar archive, it fits in a #FS.
### engine.#FS Inputs
_No input._
### engine.#FS Outputs
_No output._
## engine.#GitPull
Pull a directory from a git remote
### engine.#GitPull Inputs
_No input._
### engine.#GitPull Outputs
_No output._
## engine.#GitPush
Push a directory to a git remote
### engine.#GitPush Inputs
_No input._
### engine.#GitPush Outputs
_No output._
## engine.#HTTPFetch
Fetch a file over HTTP
### engine.#HTTPFetch Inputs
_No input._
### engine.#HTTPFetch Outputs
_No output._
## engine.#ImageConfig
Container image config. See [OCI](https://www.opencontainers.org/). Spec left open on purpose to account for additional fields. [Image Spec](https://github.com/opencontainers/image-spec/blob/main/specs-go/v1/config.go) [Docker Superset](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/dockerfile2llb/image.go)
### engine.#ImageConfig Inputs
_No input._
### engine.#ImageConfig Outputs
_No output._
## engine.#Merge
Merge multiple FS trees into one
### engine.#Merge Inputs
_No input._
### engine.#Merge Outputs
_No output._
## engine.#Mkdir
Create a directory
### engine.#Mkdir Inputs
_No input._
### engine.#Mkdir Outputs
_No output._
## engine.#Mount
A transient filesystem mount.
### engine.#Mount Inputs
_No input._
### engine.#Mount Outputs
_No output._
## engine.#Plan
A deployment plan executed by `dagger up`
### engine.#Plan Inputs
_No input._
### engine.#Plan Outputs
_No output._
## engine.#Pull
Download a container image from a remote repository
### engine.#Pull Inputs
_No input._
### engine.#Pull Outputs
_No output._
## engine.#Push
Upload a container image to a remote repository
### engine.#Push Inputs
_No input._
### engine.#Push Outputs
_No output._
## engine.#ReadFile
Read a file from a filesystem tree
### engine.#ReadFile Inputs
_No input._
### engine.#ReadFile Outputs
_No output._
## engine.#Scratch
Produce an empty directory
### engine.#Scratch Inputs
_No input._
### engine.#Scratch Outputs
_No output._
## engine.#Secret
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.
### engine.#Secret Inputs
_No input._
### engine.#Secret Outputs
_No output._
## engine.#Service
A reference to a network service endpoint, for example: - A TCP or UDP port - A unix or npipe socket - An HTTPS endpoint
### engine.#Service Inputs
_No input._
### engine.#Service Outputs
_No output._
## engine.#TempDir
A temporary directory for command execution
### engine.#TempDir Inputs
_No input._
### engine.#TempDir Outputs
_No output._
## engine.#WriteFile
Write a file to a filesystem tree, creating it if needed
### engine.#WriteFile Inputs
_No input._
### engine.#WriteFile Outputs
_No output._

View File

@ -2,7 +2,7 @@ package docker
import ( import (
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/dagger/engine/spec/engine" "dagger.io/dagger/engine"
) )
// Modular build API for Docker containers // Modular build API for Docker containers

View File

@ -4,7 +4,7 @@ package docker
import ( import (
"list" "list"
"dagger.io/dagger/engine/spec/engine" "dagger.io/dagger/engine"
"dagger.io/dagger" "dagger.io/dagger"
) )

View File

@ -5,7 +5,7 @@ import (
"strings" "strings"
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/dagger/engine/spec/engine" "dagger.io/dagger/engine"
"universe.dagger.io/alpine" "universe.dagger.io/alpine"
"universe.dagger.io/bash" "universe.dagger.io/bash"

View File

@ -3,6 +3,7 @@ package engine
// Execute a command in a container // Execute a command in a container
#Exec: { #Exec: {
_type: "Exec" _type: "Exec"
$dagger: task: _name: "Exec"
// Container filesystem // Container filesystem
input: #FS input: #FS

View File

@ -3,6 +3,7 @@ package engine
// Read a file from a filesystem tree // Read a file from a filesystem tree
#ReadFile: { #ReadFile: {
_type: "ReadFile" _type: "ReadFile"
$dagger: task: _name: "ReadFile"
// Filesystem tree holding the file // Filesystem tree holding the file
input: #FS input: #FS
@ -18,6 +19,7 @@ package engine
// Write a file to a filesystem tree, creating it if needed // Write a file to a filesystem tree, creating it if needed
#WriteFile: { #WriteFile: {
_type: "WriteFile" _type: "WriteFile"
$dagger: task: _name: "WriteFile"
// Input filesystem tree // Input filesystem tree
input: #FS input: #FS
@ -31,3 +33,56 @@ package engine
// Output filesystem tree // Output filesystem tree
output: #FS output: #FS
} }
// Produce an empty directory
#Scratch: {
@dagger(notimplemented)
$dagger: task: _name: "Scratch"
output: #FS
}
// Create a directory
#Mkdir: {
@dagger(notimplemented)
$dagger: task: _name: "Mkdir"
input: #FS
// Path of the directory
path: string
// FIXME: permissions?
mode: int
// Create parent directories as needed?
parents: *true | false
output: #FS
}
// Copy files from one FS tree to another
#Copy: {
@dagger(notimplemented)
$dagger: task: _name: "Copy"
input: #FS
#CopyInfo
output: #FS
}
#CopyInfo: {
source: {
root: #FS
path: string | *"/"
}
dest: string
}
// Merge multiple FS trees into one
#Merge: {
@dagger(notimplemented)
$dagger: task: _name: "Merge"
input: #FS
layers: [...#CopyInfo]
output: #FS
}

View File

@ -2,6 +2,7 @@ package engine
// Push a directory to a git remote // Push a directory to a git remote
#GitPush: { #GitPush: {
@dagger(notimplemented)
$dagger: task: _name: "GitPush" $dagger: task: _name: "GitPush"
input: #FS input: #FS
@ -11,6 +12,7 @@ package engine
// Pull a directory from a git remote // Pull a directory from a git remote
#GitPull: { #GitPull: {
@dagger(notimplemented)
$dagger: task: _name: "GitPull" $dagger: task: _name: "GitPull"
remote: string remote: string

View File

@ -18,7 +18,8 @@ package engine
// Fetch a file over HTTP // Fetch a file over HTTP
#HTTPFetch: { #HTTPFetch: {
_httpFetch: {} @dagger(notimplemented)
$dagger: task: _name: "HTTPFetch"
// Source url // Source url
// Example: https://www.dagger.io/index.html // Example: https://www.dagger.io/index.html

View File

@ -1,5 +1,30 @@
package engine package engine
// Upload a container image to a remote repository
#Push: {
@dagger(notimplemented)
$dagger: task: _name: "Push"
// Target repository address
dest: #Ref
// Filesystem contents to push
input: #FS
// Container image config
config: #ImageConfig
// Authentication
auth: [...{
target: string
username: string
secret: string | #Secret
}]
// Complete ref of the pushed image, including digest
result: #Ref
}
// A ref is an address for a remote container image // A ref is an address for a remote container image
// //
// Examples: // Examples:
@ -23,6 +48,7 @@ package engine
// Download a container image from a remote repository // Download a container image from a remote repository
#Pull: { #Pull: {
_type: "Pull" _type: "Pull"
$dagger: task: _name: "Pull"
// Repository source ref // Repository source ref
source: #Ref source: #Ref
@ -43,3 +69,27 @@ package engine
// Downloaded container image config // Downloaded container image config
config: #ImageConfig config: #ImageConfig
} }
// Build a container image using buildkit
// FIXME: rename to #Dockerfile to clarify scope
#Build: {
@dagger(notimplemented)
$dagger: task: _name: "Build"
// Source directory to build
source: #FS
{
frontend: "dockerfile"
dockerfile: {
path: string | *"Dockerfile"
} | {
contents: string
}
}
// Root filesystem produced by build
output: #FS
// Container image config produced by build
config: #ImageConfig
}

View File

@ -1,17 +1,31 @@
package engine package engine
// A deployment plan executed by `dagger up` // A deployment plan executed by `dagger up`
#Plan: { #Plan: #DAG
// A special kind of program which `dagger` can execute.
#DAG: {
// Receive inputs from the client // Receive inputs from the client
inputs: { inputs: {
// Receive directories // Receive directories
directories: [string]: _#inputDirectory directories: [name=string]: _#inputDirectory
// Securely receive secrets // Securely receive secrets
secrets: [string]: _#inputSecret secrets: [name=string]: _#inputSecret
// Receive runtime parameters
params: {
@dagger(notimplemented)
[name=string]: _
}
}
// Send outputs to the client
outputs: {
@dagger(notimplemented)
directories: [name=string]: _#outputDirectory
} }
// Forward network services to and from the client // Forward network services to and from the client
proxy: [string]: _#proxyEndpoint proxy: [endpoint=string]: _#proxyEndpoint
// Execute actions in containers // Execute actions in containers
actions: { actions: {
@ -20,9 +34,11 @@ package engine
} }
_#inputDirectory: { _#inputDirectory: {
// FIXME: rename to "InputDirectory" for consistency
_type: "LocalDirectory"
// Import from this path ON THE CLIENT MACHINE // Import from this path ON THE CLIENT MACHINE
// Example: "/Users/Alice/dev/todoapp/src" // Example: "/Users/Alice/dev/todoapp/src"
_type: "LocalDirectory"
path: string path: string
// Filename patterns to include // Filename patterns to include
@ -47,6 +63,14 @@ _#inputSecret: {
contents: #Secret contents: #Secret
{ {
@dagger(notimplemented)
// Execute a command ON THE CLIENT MACHINE and read secret from standard output
command: [string, ...string] | string
// Execute command in an interactive terminal
// for example to prompt for a passphrase
interactive: true | *false
} | {
// Read secret from a file ON THE CLIENT MACHINE // Read secret from a file ON THE CLIENT MACHINE
_type: "SecretFile" _type: "SecretFile"
path: string path: string
@ -57,16 +81,45 @@ _#inputSecret: {
} }
} }
_#outputDirectory: {
@dagger(notimplemented)
// Filesystem contents to export
// Reference an #FS field produced by an action
contents: #FS
// Export to this path ON THE CLIENT MACHINE
dest: string
}
// Forward a network endpoint to and from the client // Forward a network endpoint to and from the client
_#proxyEndpoint: { _#proxyEndpoint: {
// Service endpoint can be proxied to action containers as unix sockets // 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 #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
// FIXME: reconcile with spec
_type: "Service" _type: "Service"
// FIXME: should be endpoint
service: #Service service: #Service
endpoint: service
{ {
// FIXME: reconcile with spec
unix: string unix: string
} | { } | {
// FIXME: reconcile with spec
npipe: string 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://).*"

View File

@ -1,4 +0,0 @@
package engine
// A network service address
#Address: string & =~"^(tcp://|unix://|udp://).*"

View File

@ -1,71 +0,0 @@
package engine
// Execute a command in a container
#Exec: {
$dagger: task: _name: "Exec"
// Container filesystem
input: #FS
// Transient filesystem mounts
// Key is an arbitrary name, for example "app source code"
// Value is mount configuration
mounts: [name=string]: #Mount
// Command to execute
// Example: ["echo", "hello, world!"]
args: [...string]
// Environment variables
env: [key=string]: string
// Working directory
workdir: string | *"/"
// User ID or name
user: string | *"root"
// If set, always execute even if the operation could be cached
always: true | *false
// Modified filesystem
output: #FS
// Command exit code
// Currently this field can only ever be zero.
// If the command fails, DAG execution is immediately terminated.
// FIXME: expand API to allow custom handling of failed commands
exit: int & 0
// Inject hostname resolution into the container
// key is hostname, value is IP
hosts: [hostname=string]: string
}
// A transient filesystem mount.
#Mount: {
dest: string
{
contents: #CacheDir | #TempDir | #Service
} | {
contents: #FS
source: string | *"/"
ro: true | *false
} | {
contents: #Secret
uid: uint32 | *0
gid: uint32 | *0
optional: true | *false
}
}
// A (best effort) persistent cache dir
#CacheDir: {
id: string
concurrency: *"shared" | "private" | "locked"
}
// A temporary directory for command execution
#TempDir: {
size?: int64
}

View File

@ -1,53 +0,0 @@
package engine
// Produce an empty directory
// FIXME: replace with a null value for #FS?
#Scratch: {
$dagger: task: _name: "Scratch"
output: #FS
}
#ReadFile: $dagger: task: _name: "ReadFile"
#WriteFile: $dagger: task: _name: "WriteFile"
// Create a directory
#Mkdir: {
$dagger: task: _name: "Mkdir"
input: #FS
// Path of the directory
path: string
// FIXME: permissions?
mode: int
// Create parent directories as needed?
parents: *true | false
output: #FS
}
#Copy: {
$dagger: task: _name: "Copy"
input: #FS
#CopyInfo
output: #FS
}
#CopyInfo: {
source: {
root: #FS
path: string | *"/"
}
dest: string
}
#Merge: {
$dagger: task: _name: "Merge"
input: #FS
layers: [...#CopyInfo]
output: #FS
}

View File

@ -1,51 +0,0 @@
package engine
// 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: [...{
target: string
username: string
secret: string | #Secret
}]
// Complete ref of the pushed image, including digest
result: #Ref
}
// Download a container image from a remote repository
#Pull: $dagger: task: _name: "Pull"
// Build a container image using buildkit
// FIXME: rename to #Dockerfile to clarify scope
#Build: {
$dagger: task: _name: "Build"
// Source directory to build
source: #FS
{
frontend: "dockerfile"
dockerfile: {
path: string | *"Dockerfile"
} | {
contents: string
}
}
// Root filesystem produced by build
output: #FS
// Container image config produced by build
config: #ImageConfig
}

View File

@ -1,102 +0,0 @@
// The Dagger API.
package engine
// A deployment plan executed by `dagger up`
#Plan: #DAG
// A special kind of program which `dagger` can execute.
#DAG: {
// 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: {
directories: [name=string]: _#outputDirectory
}
// Forward network services to and from the client
proxy: [name=string]: _#proxyEndpoint
// Execute actions in containers
actions: {
...
}
}
_#inputDirectory: {
// Import from this path ON THE CLIENT MACHINE
// Example: "/Users/Alice/dev/todoapp/src"
source: string
// Filename patterns to include
// Example: ["*.go", "Dockerfile"]
include?: [...string]
// Filename patterns to exclude
// Example: ["node_modules"]
exclude?: [...string]
// Imported filesystem contents
// Use this as input for actions requiring an #FS field
contents: #FS
}
_#outputDirectory: {
// Filesystem contents to export
// Reference an #FS field produced by an action
contents: #FS
// Export to this path ON THE CLIENT MACHINE
dest: string
}
// Securely receive a secret from the client
_#inputSecret: {
// Reference to the secret contents
// Use this by securely mounting it into a container.
// See universe.dagger.io/docker.#Run.mounts
// FIXME: `contents` field name causes confusion (not actually the secret contents..)
contents: #Secret
{
// Execute a command ON THE CLIENT MACHINE and read secret from standard output
command: [string, ...string] | string
// Execute command in an interactive terminal
// for example to prompt for a passphrase
interactive: true | *false
} | {
// Read secret from a file ON THE CLIENT MACHINE
path: string
} | {
// Read secret from an environment variable ON THE CLIENT MACHINE
envvar: string
}
}
// Forward a network endpoint to and from the client
_#proxyEndpoint: {
// Service endpoint can be proxied to action containers as unix sockets
// FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
endpoint: #Service
{
// Listen for connections ON THE CLIENT MACHINE, proxy to actions
listen: #Address
} | {
// Connect to a remote endpoint FROM THE CLIENT MACHINE, proxy to actions
connect: #Address
} | {
// Proxy to/from the contents of a file ON THE CLIENT MACHINE
filepath: string
} | {
// Proxy to/from standard input and output of a command ON THE CLIENT MACHINE
command: [string, ...string] | string
}
}

View File

@ -1,2 +0,0 @@
// Placeholder package, to keep docs generating tool happy.
package spec

View File

@ -1,7 +1,7 @@
package dagger package dagger
import ( import (
"alpha.dagger.io/europa/dagger/engine/spec/engine" "alpha.dagger.io/europa/dagger/engine"
) )
// A deployment plan executed by `dagger up` // A deployment plan executed by `dagger up`

View File

@ -1,7 +1,7 @@
package dagger package dagger
import ( import (
"alpha.dagger.io/europa/dagger/engine/spec/engine" "alpha.dagger.io/europa/dagger/engine"
) )
// A reference to a filesystem tree. // A reference to a filesystem tree.

View File

@ -1,7 +1,7 @@
package dagger package dagger
import ( import (
"alpha.dagger.io/europa/dagger/engine/spec/engine" "alpha.dagger.io/europa/dagger/engine"
) )
// Select a subdirectory from a filesystem tree // Select a subdirectory from a filesystem tree

View File

@ -14,7 +14,7 @@ import (
var ( var (
// FS contains the filesystem of the stdlib. // FS contains the filesystem of the stdlib.
//go:embed **/*.cue **/*/*.cue europa/dagger/*.cue europa/dagger/engine/*.cue europa/dagger/engine/spec/*.cue europa/dagger/engine/spec/engine/*.cue //go:embed **/*.cue **/*/*.cue europa/dagger/*.cue europa/dagger/engine/*.cue
FS embed.FS FS embed.FS
ModuleName = "alpha.dagger.io" ModuleName = "alpha.dagger.io"