Europa: reconcile engine.#Exec spec with implementation

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2021-12-14 22:33:11 +00:00 committed by Solomon Hykes
parent 19322a7cb9
commit 9e859e6233
2 changed files with 27 additions and 25 deletions

View File

@ -28,6 +28,7 @@ import (
mounts: [name=string]: engine.#Mount mounts: [name=string]: engine.#Mount
// Expose network ports // Expose network ports
// FIXME: investigate feasibility
ports: [name=string]: { ports: [name=string]: {
frontend: dagger.#Service frontend: dagger.#Service
backend: { backend: {
@ -84,12 +85,7 @@ import (
// Username or UID to ad // Username or UID to ad
// User identity for this command // User identity for this command
// Examples: "root", "0", "1002" // Examples: "root", "0", "1002"
user: string user: string | *"root"
// Optionally attach to command standard streams
stdin: dagger.#Stream | *null
stdout: dagger.#Stream | *null
stderr: dagger.#Stream | *null
// Output fields // Output fields
{ {
@ -133,11 +129,10 @@ import (
_exec: engine.#Exec & { _exec: engine.#Exec & {
args: [cmd.name] + cmd._flatFlags + cmd.args args: [cmd.name] + cmd._flatFlags + cmd.args
input: image.rootfs input: image.rootfs
"mounts": [ for mnt in mounts {mnt}] "mounts": mounts
environ: [ for k, v in env {"\(k)=\(v)"}] "env": env
"workdir": workdir "workdir": workdir
"stdin": stdin "user": user
// FIXME: user
} }
} }

View File

@ -7,32 +7,39 @@ package engine
// Container filesystem // Container filesystem
input: #FS input: #FS
// Mounts // Transient filesystem mounts
mounts: [...#Mount] // Key is an arbitrary name, for example "app source code"
// Value is mount configuration
mounts: [name=string]: #Mount
// Command to execute // Command to execute
args: [...string] | string // Example: ["echo", "hello, world!"]
args: [...string]
// Environment variables // Environment variables
environ: [...string] env: [key=string]: string
// Working directory // Working directory
workdir?: string workdir: string | *"/"
// Optionally attach to command standard input stream // User ID or name
stdin?: #Stream user: string | *"root"
// Optionally attach to command standard output stream // If set, always execute even if the operation could be cached
stdout?: #Stream always: true | *false
// Optionally attach to command standard error stream
stderr?: #Stream
// Modified filesystem // Modified filesystem
output: #FS output: #FS
// Command exit code // Command exit code
exit: int // 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. // A transient filesystem mount.