cue modules: move stdlib to pkg/alpha.dagger.io
In preparation for Europa, we will vendor multiple CUE modules: - `pkg/alpha.dagger.io`: legacy non-europa packages - `pkg/dagger.io`: core Europa packages - `pkg/universe.dagger.io`: Europa universe Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
39
pkg/alpha.dagger.io/dagger/dagger.cue
Normal file
39
pkg/alpha.dagger.io/dagger/dagger.cue
Normal file
@@ -0,0 +1,39 @@
|
||||
// Dagger core types
|
||||
package dagger
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/europa/dagger/engine"
|
||||
)
|
||||
|
||||
// An artifact such as source code checkout, container image, binary archive...
|
||||
// May be passed as user input, or computed by a buildkit pipeline
|
||||
#Artifact: {
|
||||
@dagger(artifact)
|
||||
#up: [...op.#Op]
|
||||
_
|
||||
...
|
||||
}
|
||||
|
||||
// Dagger stream. Can be mounted as a UNIX socket.
|
||||
#Stream: engine.#Service
|
||||
|
||||
// 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: engine.#Secret
|
||||
|
||||
#Input: {
|
||||
@dagger(input)
|
||||
_
|
||||
...
|
||||
}
|
||||
|
||||
#Output: {
|
||||
@dagger(output)
|
||||
_
|
||||
...
|
||||
}
|
147
pkg/alpha.dagger.io/dagger/op/op.cue
Normal file
147
pkg/alpha.dagger.io/dagger/op/op.cue
Normal file
@@ -0,0 +1,147 @@
|
||||
// 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"
|
||||
dir: string
|
||||
include: [...string]
|
||||
exclude: [...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
|
||||
}
|
19
pkg/alpha.dagger.io/dagger/op/op_fullop.cue
Normal file
19
pkg/alpha.dagger.io/dagger/op/op_fullop.cue
Normal file
@@ -0,0 +1,19 @@
|
||||
@if(fullop)
|
||||
|
||||
package op
|
||||
|
||||
// Full resolution schema enforciong the complete op spec
|
||||
#Op: (#Export |
|
||||
#FetchContainer |
|
||||
#PushContainer |
|
||||
#FetchGit |
|
||||
#FetchHTTP |
|
||||
#Exec |
|
||||
#Local |
|
||||
#Copy |
|
||||
#Load |
|
||||
#Subdir |
|
||||
#Workdir |
|
||||
#WriteFile |
|
||||
#Mkdir |
|
||||
#DockerBuild) & {do: string}
|
Reference in New Issue
Block a user