This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Andrea Luzzardi a61e8dcb62 prepare the transition to #Plan.context
This change helps the transition between `dagger input` and `#Plan.context`.

In summary, the codebase now relies on a *context* for execution with mapping to *IDs*.
In the future, *context* will come from a `#Plan.context`.
In the meantime, a bridge converts `dagger input` to a plan context. This allows both *old* and *new* style configurations to co-exist with the same underlying engine.

- Implement `plancontext`. Context holds the execution context for a plan. Currently this includes the platform, local directories, secrets and services (e.g. unix/npipe).
- Contextual data can be registered at any point. In the future, this will be done by `#Plan.context`
- Migrated the `dagger input` codebase to register inputs in a `plancontext`
- Migrated low-level types/operations to the *Context ID* pattern.
  - `dagger.#Stream` now only includes an `id` (instead of `unix` path)
  - `dagger.#Secret` still includes only an ID, but now it's based off `plancontext`
  - `op.#Local` now only includes an `id` (instead of `path`, `include`, `exclude`.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-11-19 11:29:38 -08:00

146 lines
2.7 KiB
CUE

// op: low-level operations for Dagger processing pipelines
package op
// One operation in a pipeline
//
// FIXME: #Op does not current enforce the op spec at full resolution, to avoid
// FIXME: triggering performance issues. See https://github.com/dagger/dagger/issues/445
// FIXME: To enforce the full #Op spec (see op_fullop.cue), run with "-t fullop"
#Op: {
do: string
...
}
// Export a value from fs state to cue
#Export: {
do: "export"
// Source path in the container
source: string
format: "json" | "yaml" | *"string"
}
#Local: {
do: "local"
id: string
}
// FIXME: bring back load (more efficient than copy)
#Load: {
do: "load"
from: _
}
#Subdir: {
do: "subdir"
dir: string
}
#Workdir: {
do: "workdir"
path: string
}
#Exec: {
do: "exec"
args: [...string]
env?: [string]: string
// `true` means also ignoring the mount cache volumes
always?: true | *false
dir: string | *"/"
// HACK: FIXME later [Performance related]
// mount: [string]: "tmpfs" | "cache" | {from: _, path: string | *"/"} | {secret: _}
// https://github.com/dagger/dagger/issues/856
mount: [string]: {
_
...
}
// Map of hostnames to ip
hosts?: [string]: string
// User to exec with (if left empty, will default to the set user in the image)
user?: string
}
#DockerLogin: {
do: "docker-login"
target: string
username: string
// FIXME: should be a #Secret (circular import)
secret: _ @dagger(secret)
}
#FetchContainer: {
do: "fetch-container"
ref: string
}
#PushContainer: {
do: "push-container"
ref: string
}
#SaveImage: {
do: "save-image"
tag: string
dest: string
}
#FetchGit: {
do: "fetch-git"
remote: string
ref: string
keepGitDir?: bool
// FIXME: the two options are currently ignored until we support buildkit secrets
authToken?: _ @dagger(secret)
authHeader?: _ @dagger(secret)
}
#FetchHTTP: {
do: "fetch-http"
url: string
checksum?: string
filename?: string
mode?: int | *0o644
uid?: int
gid?: int
}
#Copy: {
do: "copy"
from: _
src: string | *"/"
dest: string | *"/"
}
#DockerBuild: {
do: "docker-build"
// We accept either a context, a Dockerfile or both together
context?: _
dockerfilePath?: string // path to the Dockerfile (defaults to "Dockerfile")
dockerfile?: string
platforms?: [...string]
buildArg?: {
// FIXME: should be `[string]: string | #Secret` (circular import)
[string]: string | _ @dagger(secret)
}
label?: [string]: string
target?: string
hosts?: [string]: string
}
#WriteFile: {
do: "write-file"
// FIXME: "contents" to follow english convention
content: string | bytes
dest: string
mode: int | *0o644
}
#Mkdir: {
do: "mkdir"
dir: *"/" | string
path: string
mode: int | *0o755
}