Merge pull request #12 from dubo-dubon-duponey/fix-examples
Fix examples
This commit is contained in:
commit
8cda7e9b13
@ -10,14 +10,14 @@ package dagger
|
|||||||
// The DAG architecture has many benefits:
|
// The DAG architecture has many benefits:
|
||||||
// - Because DAGs are made of nodes executing in parallel, they are easy to scale.
|
// - Because DAGs are made of nodes executing in parallel, they are easy to scale.
|
||||||
// - Because all inputs and outputs are snapshotted and content-addressed, DAGs
|
// - Because all inputs and outputs are snapshotted and content-addressed, DAGs
|
||||||
// can easily be made repeatable, can be cached aggressively, and can be replayed
|
// can easily be made repeatable, can be cached aggressively, and can be replayed
|
||||||
// at will.
|
// at will.
|
||||||
// - Because nodes are executed by the same container engine as docker-build, DAGs
|
// - Because nodes are executed by the same container engine as docker-build, DAGs
|
||||||
// can be developed using any language or technology capable of running in a docker.
|
// can be developed using any language or technology capable of running in a docker.
|
||||||
// Dockerfiles and docker images are natively supported for maximum compatibility.
|
// Dockerfiles and docker images are natively supported for maximum compatibility.
|
||||||
//
|
//
|
||||||
// - Because DAGs are programmed declaratively with a powerful configuration language,
|
// - Because DAGs are programmed declaratively with a powerful configuration language,
|
||||||
// they are much easier to test, debug and refactor than traditional programming languages.
|
// they are much easier to test, debug and refactor than traditional programming languages.
|
||||||
//
|
//
|
||||||
// To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called
|
// To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called
|
||||||
// llb, and executes it with buildkit.
|
// llb, and executes it with buildkit.
|
||||||
@ -31,42 +31,19 @@ package dagger
|
|||||||
// A dagger component is a configuration value augmented
|
// A dagger component is a configuration value augmented
|
||||||
// by scripts defining how to compute it, present it to a user,
|
// by scripts defining how to compute it, present it to a user,
|
||||||
// encrypt it, etc.
|
// encrypt it, etc.
|
||||||
#Component: #dagger: {
|
|
||||||
// script to compute the value
|
|
||||||
compute?: #Script
|
|
||||||
|
|
||||||
terminal?: {
|
// FIXME: #Component will not match embedded scalars.
|
||||||
// Display a message when opening a terminal session
|
// use Runtime.isComponent() for a reliable check
|
||||||
greeting?: string
|
#Component: {
|
||||||
command: [string]: #Script
|
#dagger: #ComponentConfig
|
||||||
}
|
...
|
||||||
// Configure how the component is incorporated to user settings.
|
|
||||||
// Configure how the end-user can configure this component
|
|
||||||
settings?: {
|
|
||||||
// If not specified, scrape from comments
|
|
||||||
title?: string
|
|
||||||
description?: string
|
|
||||||
// Disable user input, even if incomplete?
|
|
||||||
hidden: true | *false
|
|
||||||
ui: _ // insert here something which can be compiled to react-jsonschema-form
|
|
||||||
// Show the cue default value to the user, as a default input value?
|
|
||||||
showDefault: true | *false
|
|
||||||
|
|
||||||
// Insert information needed by:
|
|
||||||
// 1) clients to encrypt
|
|
||||||
// ie. web wizard, cli
|
|
||||||
// 2) middleware to implement deicphering in the cuellb pipeline
|
|
||||||
// eg. integration with clcoud KMS, Vault...
|
|
||||||
//
|
|
||||||
// 3) connectors to make sure secrets are preserved
|
|
||||||
encrypt?: {
|
|
||||||
pubkey: string
|
|
||||||
cipher: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The contents of a #dagger annotation
|
||||||
|
#ComponentConfig: {
|
||||||
|
// script to compute the value
|
||||||
|
compute?: #Script
|
||||||
|
}
|
||||||
|
|
||||||
// Any component can be referenced as a directory, since
|
// Any component can be referenced as a directory, since
|
||||||
// every dagger script outputs a filesystem state (aka a directory)
|
// every dagger script outputs a filesystem state (aka a directory)
|
||||||
@ -75,30 +52,68 @@ package dagger
|
|||||||
#Script: [...#Op]
|
#Script: [...#Op]
|
||||||
|
|
||||||
// One operation in a script
|
// One operation in a script
|
||||||
#Op: #Fetch | #Export | #Run | #Local
|
#Op: #FetchContainer | #FetchGit | #Export | #Exec | #Local | #Copy | #Load
|
||||||
|
|
||||||
// Export a value from fs state to cue
|
// Export a value from fs state to cue
|
||||||
#Export: ["export", string, "json"|"yaml"|"string"|"number"|"boolean"]
|
#Export: {
|
||||||
|
do: "export"
|
||||||
#Run: #runNoOpts | #runWithOpts
|
// Source path in the container
|
||||||
#runNoOpts: ["run", ...string]
|
source: string
|
||||||
#runWithOpts: ["run", #RunOpts, ...string]
|
format: "json" | "yaml" | *"string" | "number" | "boolean"
|
||||||
|
|
||||||
#RunOpts: {
|
|
||||||
mount?: string: "tmpfs" | "cache" | { from: #Component|#Script }
|
|
||||||
env: [string]: string
|
|
||||||
dir: string | *"/"
|
|
||||||
always: true | *false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Local: ["local", string]
|
#Local: {
|
||||||
|
do: "local"
|
||||||
|
dir: string
|
||||||
|
include?: [...string] | *[]
|
||||||
|
}
|
||||||
|
|
||||||
#Fetch: #FetchGit | #FetchContainer
|
// FIXME: bring back load (more efficient than copy)
|
||||||
#FetchContainer: ["fetch", "container", string]
|
|
||||||
#FetchGit: ["fetch", "git", string, string]
|
|
||||||
|
|
||||||
|
#Load: {
|
||||||
|
do: "load"
|
||||||
|
from: #Component | #Script
|
||||||
|
}
|
||||||
|
|
||||||
|
#Exec: {
|
||||||
|
do: "exec"
|
||||||
|
args: [...string]
|
||||||
|
env?: [string]: string
|
||||||
|
always?: true | *false
|
||||||
|
dir: string | *"/"
|
||||||
|
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
|
||||||
|
}
|
||||||
|
|
||||||
|
#MountTmp: "tmpfs"
|
||||||
|
#MountCache: "cache"
|
||||||
|
#MountComponent: {
|
||||||
|
input: #Component
|
||||||
|
path: string | *"/"
|
||||||
|
}
|
||||||
|
#MountScript: {
|
||||||
|
input: #Script
|
||||||
|
path: string | *"/"
|
||||||
|
}
|
||||||
|
|
||||||
|
#FetchContainer: {
|
||||||
|
do: "fetch-container"
|
||||||
|
ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
#FetchGit: {
|
||||||
|
do: "fetch-git"
|
||||||
|
remote: string
|
||||||
|
ref: string
|
||||||
|
}
|
||||||
|
|
||||||
|
#Copy: {
|
||||||
|
do: "copy"
|
||||||
|
from: #Script | #Component
|
||||||
|
src: string | *"/"
|
||||||
|
dest: string | *"/"
|
||||||
|
}
|
||||||
|
|
||||||
#TestScript: #Script & [
|
#TestScript: #Script & [
|
||||||
["fetch", "container", "alpine:latest"],
|
{do: "fetch-container", ref: "alpine:latest"},
|
||||||
["run", "echo", "hello", "world"]
|
{do: "exec", args: ["echo", "hello", "world"]},
|
||||||
]
|
]
|
||||||
|
@ -36,10 +36,14 @@ package: [string]: true | false | string
|
|||||||
if (info & true) != _|_ {
|
if (info & true) != _|_ {
|
||||||
do: "exec"
|
do: "exec"
|
||||||
args: ["apk", "add", "-U", "--no-cache", pkg]
|
args: ["apk", "add", "-U", "--no-cache", pkg]
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/6
|
||||||
|
mount: foo: {}
|
||||||
}
|
}
|
||||||
if (info & string) != _|_ {
|
if (info & string) != _|_ {
|
||||||
do: "exec"
|
do: "exec"
|
||||||
args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"]
|
args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"]
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/6
|
||||||
|
mount: foo: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -10,14 +10,14 @@ package dagger
|
|||||||
// The DAG architecture has many benefits:
|
// The DAG architecture has many benefits:
|
||||||
// - Because DAGs are made of nodes executing in parallel, they are easy to scale.
|
// - Because DAGs are made of nodes executing in parallel, they are easy to scale.
|
||||||
// - Because all inputs and outputs are snapshotted and content-addressed, DAGs
|
// - Because all inputs and outputs are snapshotted and content-addressed, DAGs
|
||||||
// can easily be made repeatable, can be cached aggressively, and can be replayed
|
// can easily be made repeatable, can be cached aggressively, and can be replayed
|
||||||
// at will.
|
// at will.
|
||||||
// - Because nodes are executed by the same container engine as docker-build, DAGs
|
// - Because nodes are executed by the same container engine as docker-build, DAGs
|
||||||
// can be developed using any language or technology capable of running in a docker.
|
// can be developed using any language or technology capable of running in a docker.
|
||||||
// Dockerfiles and docker images are natively supported for maximum compatibility.
|
// Dockerfiles and docker images are natively supported for maximum compatibility.
|
||||||
//
|
//
|
||||||
// - Because DAGs are programmed declaratively with a powerful configuration language,
|
// - Because DAGs are programmed declaratively with a powerful configuration language,
|
||||||
// they are much easier to test, debug and refactor than traditional programming languages.
|
// they are much easier to test, debug and refactor than traditional programming languages.
|
||||||
//
|
//
|
||||||
// To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called
|
// To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called
|
||||||
// llb, and executes it with buildkit.
|
// llb, and executes it with buildkit.
|
||||||
@ -31,45 +31,19 @@ package dagger
|
|||||||
// A dagger component is a configuration value augmented
|
// A dagger component is a configuration value augmented
|
||||||
// by scripts defining how to compute it, present it to a user,
|
// by scripts defining how to compute it, present it to a user,
|
||||||
// encrypt it, etc.
|
// encrypt it, etc.
|
||||||
#Component: {
|
|
||||||
#dagger: {
|
|
||||||
// script to compute the value
|
|
||||||
compute?: #Script
|
|
||||||
|
|
||||||
terminal?: {
|
|
||||||
// Display a message when opening a terminal session
|
|
||||||
greeting?: string
|
|
||||||
command: [string]: #Script
|
|
||||||
}
|
|
||||||
// Configure how the component is incorporated to user settings.
|
|
||||||
// Configure how the end-user can configure this component
|
|
||||||
settings?: {
|
|
||||||
// If not specified, scrape from comments
|
|
||||||
title?: string
|
|
||||||
description?: string
|
|
||||||
// Disable user input, even if incomplete?
|
|
||||||
hidden: true | *false
|
|
||||||
ui: _ // insert here something which can be compiled to react-jsonschema-form
|
|
||||||
// Show the cue default value to the user, as a default input value?
|
|
||||||
showDefault: true | *false
|
|
||||||
|
|
||||||
// Insert information needed by:
|
// FIXME: #Component will not match embedded scalars.
|
||||||
// 1) clients to encrypt
|
// use Runtime.isComponent() for a reliable check
|
||||||
// ie. web wizard, cli
|
#Component: {
|
||||||
// 2) middleware to implement deicphering in the cuellb pipeline
|
#dagger: #ComponentConfig
|
||||||
// eg. integration with clcoud KMS, Vault...
|
|
||||||
//
|
|
||||||
// 3) connectors to make sure secrets are preserved
|
|
||||||
encrypt?: {
|
|
||||||
pubkey: string
|
|
||||||
cipher: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The contents of a #dagger annotation
|
||||||
|
#ComponentConfig: {
|
||||||
|
// script to compute the value
|
||||||
|
compute?: #Script
|
||||||
|
}
|
||||||
|
|
||||||
// Any component can be referenced as a directory, since
|
// Any component can be referenced as a directory, since
|
||||||
// every dagger script outputs a filesystem state (aka a directory)
|
// every dagger script outputs a filesystem state (aka a directory)
|
||||||
@ -78,68 +52,68 @@ package dagger
|
|||||||
#Script: [...#Op]
|
#Script: [...#Op]
|
||||||
|
|
||||||
// One operation in a script
|
// One operation in a script
|
||||||
// #Op: #FetchContainer | #FetchGit | #Export | #Exec | #Copy | #Load
|
#Op: #FetchContainer | #FetchGit | #Export | #Exec | #Local | #Copy | #Load
|
||||||
#Op: #FetchContainer | #Export | #Exec
|
|
||||||
|
|
||||||
// Export a value from fs state to cue
|
// Export a value from fs state to cue
|
||||||
#Export: {
|
#Export: {
|
||||||
do: "export"
|
do: "export"
|
||||||
// Source path in the container
|
// Source path in the container
|
||||||
source: string
|
source: string
|
||||||
format: "json"|"yaml"|*"string"|"number"|"boolean"
|
format: "json" | "yaml" | *"string" | "number" | "boolean"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Load: #LoadComponent| #LoadScript
|
#Local: {
|
||||||
#LoadComponent: {
|
do: "local"
|
||||||
do: "load"
|
dir: string
|
||||||
from: #Component
|
include?: [...string] | *[]
|
||||||
}
|
|
||||||
#LoadScript: {
|
|
||||||
do: "load"
|
|
||||||
from: #Script
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: bring back load (more efficient than copy)
|
||||||
|
|
||||||
|
#Load: {
|
||||||
|
do: "load"
|
||||||
|
from: #Component | #Script
|
||||||
|
}
|
||||||
|
|
||||||
#Exec: {
|
#Exec: {
|
||||||
do: "exec"
|
do: "exec"
|
||||||
args: [...string]
|
args: [...string]
|
||||||
|
env?: [string]: string
|
||||||
|
always?: true | *false
|
||||||
|
dir: string | *"/"
|
||||||
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
|
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
|
||||||
env: [string]: string
|
|
||||||
dir: string | *"/"
|
|
||||||
always: true | *false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#MountTmp: "tmpfs"
|
#MountTmp: "tmpfs"
|
||||||
#MountCache: "cache"
|
#MountCache: "cache"
|
||||||
#MountComponent: {
|
#MountComponent: {
|
||||||
input: #Component
|
input: #Component
|
||||||
path: string | *"/"
|
path: string | *"/"
|
||||||
}
|
}
|
||||||
#MountScript: {
|
#MountScript: {
|
||||||
input: #Script
|
input: #Script
|
||||||
path: string | *"/"
|
path: string | *"/"
|
||||||
}
|
}
|
||||||
|
|
||||||
#FetchContainer: {
|
#FetchContainer: {
|
||||||
do: "fetch-container"
|
do: "fetch-container"
|
||||||
ref: string
|
ref: string
|
||||||
}
|
}
|
||||||
|
|
||||||
#FetchGit: {
|
#FetchGit: {
|
||||||
do: "fetch-git"
|
do: "fetch-git"
|
||||||
remote: string
|
remote: string
|
||||||
ref: string
|
ref: string
|
||||||
}
|
}
|
||||||
|
|
||||||
#Copy: {
|
#Copy: {
|
||||||
do: "copy"
|
do: "copy"
|
||||||
input: #Script | #Component
|
from: #Script | #Component
|
||||||
src: string | *"/"
|
src: string | *"/"
|
||||||
dest: string | *"/"
|
dest: string | *"/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#TestScript: #Script & [
|
#TestScript: #Script & [
|
||||||
{ do: "fetch-container", ref: "alpine:latest" },
|
{do: "fetch-container", ref: "alpine:latest"},
|
||||||
{ do: "exec", args: ["echo", "hello", "world" ], env: DEBUG: "1" }
|
{do: "exec", args: ["echo", "hello", "world"]},
|
||||||
]
|
]
|
||||||
|
@ -2,62 +2,62 @@ package example
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.cloud/alpine"
|
"dagger.cloud/alpine"
|
||||||
|
"dagger.cloud/dagger"
|
||||||
)
|
)
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
string
|
string
|
||||||
#dagger: compute: [
|
#dagger: compute: [
|
||||||
{ do: "load", from: alpine },
|
dagger.#Load & { from: alpine },
|
||||||
{
|
dagger.#Copy & {
|
||||||
do: "copy"
|
|
||||||
from: [
|
from: [
|
||||||
{ do: "fetch-container", ref: alpine.ref },
|
dagger.#FetchContainer & { ref: alpine.ref },
|
||||||
]
|
]
|
||||||
dest: "/src"
|
dest: "/src"
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/9
|
||||||
|
src: "/"
|
||||||
},
|
},
|
||||||
{
|
dagger.#Exec & {
|
||||||
do: "exec"
|
|
||||||
dir: "/src"
|
dir: "/src"
|
||||||
args: ["sh", "-c", """
|
args: ["sh", "-c", """
|
||||||
ls -l > /tmp/out
|
ls -l > /tmp/out
|
||||||
"""
|
"""
|
||||||
]
|
]
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/6
|
||||||
|
mount: foo: {}
|
||||||
|
// mount: dagger.#Mount
|
||||||
|
},
|
||||||
|
dagger.#Export & {
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/8
|
||||||
|
// source: "/tmp/out"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
do: "export"
|
|
||||||
source: "/tmp/out"
|
|
||||||
format: "string"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
www: {
|
www: {
|
||||||
|
|
||||||
// Domain where the site will be deployed (user input)
|
// Domain where the site will be deployed (user input)
|
||||||
domain: string
|
domain: string
|
||||||
|
|
||||||
// URL after deployment (computed)
|
|
||||||
url: {
|
url: {
|
||||||
string & =~ "https://.*"
|
string & =~ "https://.*"
|
||||||
|
|
||||||
#dagger: {
|
// https://github.com/blocklayerhq/dagger/issues/10
|
||||||
compute: [
|
#dagger2: compute: [
|
||||||
{ do: "load", from: alpine },
|
dagger.#Load & { from: alpine },
|
||||||
{
|
dagger.#Exec & {
|
||||||
do: "exec"
|
args: ["sh", "-c",
|
||||||
args: ["sh", "-c",
|
"""
|
||||||
"""
|
echo 'deploying to netlify (not really)'
|
||||||
echo 'deploying to netlify (not really)'
|
echo 'https://\(domain)/foo' > /tmp/out
|
||||||
echo 'https://\(domain)/foo' > /tmp/out
|
"""
|
||||||
"""
|
]
|
||||||
]
|
// https://github.com/blocklayerhq/dagger/issues/6
|
||||||
},
|
mount: foo: {}
|
||||||
{
|
},
|
||||||
do: "export"
|
dagger.#Export & {
|
||||||
source: "/tmp/out"
|
// https://github.com/blocklayerhq/dagger/issues/8
|
||||||
format: "string"
|
// source: "/tmp/out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,14 @@ package: [string]: true | false | string
|
|||||||
if (info & true) != _|_ {
|
if (info & true) != _|_ {
|
||||||
do: "exec"
|
do: "exec"
|
||||||
args: ["apk", "add", "-U", "--no-cache", pkg]
|
args: ["apk", "add", "-U", "--no-cache", pkg]
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/6
|
||||||
|
mount: foo: {}
|
||||||
}
|
}
|
||||||
if (info & string) != _|_ {
|
if (info & string) != _|_ {
|
||||||
do: "exec"
|
do: "exec"
|
||||||
args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"]
|
args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"]
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/6
|
||||||
|
mount: foo: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -10,14 +10,14 @@ package dagger
|
|||||||
// The DAG architecture has many benefits:
|
// The DAG architecture has many benefits:
|
||||||
// - Because DAGs are made of nodes executing in parallel, they are easy to scale.
|
// - Because DAGs are made of nodes executing in parallel, they are easy to scale.
|
||||||
// - Because all inputs and outputs are snapshotted and content-addressed, DAGs
|
// - Because all inputs and outputs are snapshotted and content-addressed, DAGs
|
||||||
// can easily be made repeatable, can be cached aggressively, and can be replayed
|
// can easily be made repeatable, can be cached aggressively, and can be replayed
|
||||||
// at will.
|
// at will.
|
||||||
// - Because nodes are executed by the same container engine as docker-build, DAGs
|
// - Because nodes are executed by the same container engine as docker-build, DAGs
|
||||||
// can be developed using any language or technology capable of running in a docker.
|
// can be developed using any language or technology capable of running in a docker.
|
||||||
// Dockerfiles and docker images are natively supported for maximum compatibility.
|
// Dockerfiles and docker images are natively supported for maximum compatibility.
|
||||||
//
|
//
|
||||||
// - Because DAGs are programmed declaratively with a powerful configuration language,
|
// - Because DAGs are programmed declaratively with a powerful configuration language,
|
||||||
// they are much easier to test, debug and refactor than traditional programming languages.
|
// they are much easier to test, debug and refactor than traditional programming languages.
|
||||||
//
|
//
|
||||||
// To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called
|
// To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called
|
||||||
// llb, and executes it with buildkit.
|
// llb, and executes it with buildkit.
|
||||||
@ -31,45 +31,19 @@ package dagger
|
|||||||
// A dagger component is a configuration value augmented
|
// A dagger component is a configuration value augmented
|
||||||
// by scripts defining how to compute it, present it to a user,
|
// by scripts defining how to compute it, present it to a user,
|
||||||
// encrypt it, etc.
|
// encrypt it, etc.
|
||||||
#Component: {
|
|
||||||
#dagger: {
|
|
||||||
// script to compute the value
|
|
||||||
compute?: #Script
|
|
||||||
|
|
||||||
terminal?: {
|
|
||||||
// Display a message when opening a terminal session
|
|
||||||
greeting?: string
|
|
||||||
command: [string]: #Script
|
|
||||||
}
|
|
||||||
// Configure how the component is incorporated to user settings.
|
|
||||||
// Configure how the end-user can configure this component
|
|
||||||
settings?: {
|
|
||||||
// If not specified, scrape from comments
|
|
||||||
title?: string
|
|
||||||
description?: string
|
|
||||||
// Disable user input, even if incomplete?
|
|
||||||
hidden: true | *false
|
|
||||||
ui: _ // insert here something which can be compiled to react-jsonschema-form
|
|
||||||
// Show the cue default value to the user, as a default input value?
|
|
||||||
showDefault: true | *false
|
|
||||||
|
|
||||||
// Insert information needed by:
|
// FIXME: #Component will not match embedded scalars.
|
||||||
// 1) clients to encrypt
|
// use Runtime.isComponent() for a reliable check
|
||||||
// ie. web wizard, cli
|
#Component: {
|
||||||
// 2) middleware to implement deicphering in the cuellb pipeline
|
#dagger: #ComponentConfig
|
||||||
// eg. integration with clcoud KMS, Vault...
|
|
||||||
//
|
|
||||||
// 3) connectors to make sure secrets are preserved
|
|
||||||
encrypt?: {
|
|
||||||
pubkey: string
|
|
||||||
cipher: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The contents of a #dagger annotation
|
||||||
|
#ComponentConfig: {
|
||||||
|
// script to compute the value
|
||||||
|
compute?: #Script
|
||||||
|
}
|
||||||
|
|
||||||
// Any component can be referenced as a directory, since
|
// Any component can be referenced as a directory, since
|
||||||
// every dagger script outputs a filesystem state (aka a directory)
|
// every dagger script outputs a filesystem state (aka a directory)
|
||||||
@ -78,68 +52,68 @@ package dagger
|
|||||||
#Script: [...#Op]
|
#Script: [...#Op]
|
||||||
|
|
||||||
// One operation in a script
|
// One operation in a script
|
||||||
// #Op: #FetchContainer | #FetchGit | #Export | #Exec | #Copy | #Load
|
#Op: #FetchContainer | #FetchGit | #Export | #Exec | #Local | #Copy | #Load
|
||||||
#Op: #FetchContainer | #Export | #Exec
|
|
||||||
|
|
||||||
// Export a value from fs state to cue
|
// Export a value from fs state to cue
|
||||||
#Export: {
|
#Export: {
|
||||||
do: "export"
|
do: "export"
|
||||||
// Source path in the container
|
// Source path in the container
|
||||||
source: string
|
source: string
|
||||||
format: "json"|"yaml"|*"string"|"number"|"boolean"
|
format: "json" | "yaml" | *"string" | "number" | "boolean"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Load: #LoadComponent| #LoadScript
|
#Local: {
|
||||||
#LoadComponent: {
|
do: "local"
|
||||||
do: "load"
|
dir: string
|
||||||
from: #Component
|
include?: [...string] | *[]
|
||||||
}
|
|
||||||
#LoadScript: {
|
|
||||||
do: "load"
|
|
||||||
from: #Script
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: bring back load (more efficient than copy)
|
||||||
|
|
||||||
|
#Load: {
|
||||||
|
do: "load"
|
||||||
|
from: #Component | #Script
|
||||||
|
}
|
||||||
|
|
||||||
#Exec: {
|
#Exec: {
|
||||||
do: "exec"
|
do: "exec"
|
||||||
args: [...string]
|
args: [...string]
|
||||||
|
env?: [string]: string
|
||||||
|
always?: true | *false
|
||||||
|
dir: string | *"/"
|
||||||
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
|
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
|
||||||
env: [string]: string
|
|
||||||
dir: string | *"/"
|
|
||||||
always: true | *false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#MountTmp: "tmpfs"
|
#MountTmp: "tmpfs"
|
||||||
#MountCache: "cache"
|
#MountCache: "cache"
|
||||||
#MountComponent: {
|
#MountComponent: {
|
||||||
input: #Component
|
input: #Component
|
||||||
path: string | *"/"
|
path: string | *"/"
|
||||||
}
|
}
|
||||||
#MountScript: {
|
#MountScript: {
|
||||||
input: #Script
|
input: #Script
|
||||||
path: string | *"/"
|
path: string | *"/"
|
||||||
}
|
}
|
||||||
|
|
||||||
#FetchContainer: {
|
#FetchContainer: {
|
||||||
do: "fetch-container"
|
do: "fetch-container"
|
||||||
ref: string
|
ref: string
|
||||||
}
|
}
|
||||||
|
|
||||||
#FetchGit: {
|
#FetchGit: {
|
||||||
do: "fetch-git"
|
do: "fetch-git"
|
||||||
remote: string
|
remote: string
|
||||||
ref: string
|
ref: string
|
||||||
}
|
}
|
||||||
|
|
||||||
#Copy: {
|
#Copy: {
|
||||||
do: "copy"
|
do: "copy"
|
||||||
input: #Script | #Component
|
from: #Script | #Component
|
||||||
src: string | *"/"
|
src: string | *"/"
|
||||||
dest: string | *"/"
|
dest: string | *"/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#TestScript: #Script & [
|
#TestScript: #Script & [
|
||||||
{ do: "fetch-container", ref: "alpine:latest" },
|
{do: "fetch-container", ref: "alpine:latest"},
|
||||||
{ do: "exec", args: ["echo", "hello", "world" ], env: DEBUG: "1" }
|
{do: "exec", args: ["echo", "hello", "world"]},
|
||||||
]
|
]
|
||||||
|
@ -4,6 +4,7 @@ package acme
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.cloud/alpine"
|
"dagger.cloud/alpine"
|
||||||
|
"dagger.cloud/dagger"
|
||||||
)
|
)
|
||||||
|
|
||||||
let base=alpine & {
|
let base=alpine & {
|
||||||
@ -16,7 +17,7 @@ let base=alpine & {
|
|||||||
www: {
|
www: {
|
||||||
|
|
||||||
source: {
|
source: {
|
||||||
#dagger: compute: _
|
#dagger: compute: []
|
||||||
}
|
}
|
||||||
|
|
||||||
host: string
|
host: string
|
||||||
@ -25,9 +26,16 @@ www: {
|
|||||||
string
|
string
|
||||||
|
|
||||||
#dagger: compute: [
|
#dagger: compute: [
|
||||||
{ do: "load", from: base },
|
dagger.#Load & { from: base },
|
||||||
{ do: "exec", args: ["sh", "-c", "echo -n 'https://\(host)/foo' > /tmp/out"] },
|
dagger.#Exec & {
|
||||||
{ do: "export", format: "string", source: "/tmp/out" },
|
args: ["sh", "-c", "echo -n 'https://\(host)/foo' > /tmp/out"]
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/6
|
||||||
|
mount: foo: {}
|
||||||
|
},
|
||||||
|
dagger.#Export & {
|
||||||
|
// https://github.com/blocklayerhq/dagger/issues/8
|
||||||
|
// source: "/tmp/out"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user