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

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

View File

@@ -3,6 +3,7 @@ package engine
// Read a file from a filesystem tree
#ReadFile: {
_type: "ReadFile"
$dagger: task: _name: "ReadFile"
// Filesystem tree holding the file
input: #FS
@@ -18,6 +19,7 @@ package engine
// Write a file to a filesystem tree, creating it if needed
#WriteFile: {
_type: "WriteFile"
$dagger: task: _name: "WriteFile"
// Input filesystem tree
input: #FS
@@ -31,3 +33,56 @@ package engine
// Output filesystem tree
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
#GitPush: {
@dagger(notimplemented)
$dagger: task: _name: "GitPush"
input: #FS
@@ -11,6 +12,7 @@ package engine
// Pull a directory from a git remote
#GitPull: {
@dagger(notimplemented)
$dagger: task: _name: "GitPull"
remote: string

View File

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

View File

@@ -1,5 +1,30 @@
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
//
// Examples:
@@ -23,6 +48,7 @@ package engine
// Download a container image from a remote repository
#Pull: {
_type: "Pull"
$dagger: task: _name: "Pull"
// Repository source ref
source: #Ref
@@ -43,3 +69,27 @@ package engine
// Downloaded container image config
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
// 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
inputs: {
// Receive directories
directories: [string]: _#inputDirectory
directories: [name=string]: _#inputDirectory
// 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
proxy: [string]: _#proxyEndpoint
proxy: [endpoint=string]: _#proxyEndpoint
// Execute actions in containers
actions: {
@@ -20,10 +34,12 @@ package engine
}
_#inputDirectory: {
// FIXME: rename to "InputDirectory" for consistency
_type: "LocalDirectory"
// Import from this path ON THE CLIENT MACHINE
// Example: "/Users/Alice/dev/todoapp/src"
_type: "LocalDirectory"
path: string
path: string
// Filename patterns to include
// Example: ["*.go", "Dockerfile"]
@@ -47,6 +63,14 @@ _#inputSecret: {
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
_type: "SecretFile"
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
_#proxyEndpoint: {
// Service endpoint can be proxied to action containers as unix sockets
// FIXME: should #Service be renamed to #ServiceEndpoint or #Endpoint? Naming things is hard...
// FIXME: reconcile with spec
_type: "Service"
service: #Service
_type: "Service"
// 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://).*"

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
import (
"alpha.dagger.io/europa/dagger/engine/spec/engine"
"alpha.dagger.io/europa/dagger/engine"
)
// A deployment plan executed by `dagger up`

View File

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

View File

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