Fix and improve examples/simple

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
Solomon Hykes 2021-01-26 16:37:11 -08:00
parent a26b767780
commit 6f4577d501
3 changed files with 36 additions and 17 deletions

View File

@ -33,3 +33,6 @@ integration: dagger-debug
./examples/tests/test-test.sh 2>/dev/null
# Actual integration tests
DAGGER_BINARY="./cmd/dagger/dagger-debug" time ./examples/tests/test.sh all
update-examples:
cp ./dagger/spec.cue ./examples/simple/cue.mod/pkg/dagger.cloud/dagger/dagger.cue

View File

@ -32,11 +32,15 @@ package dagger
// by scripts defining how to compute it, present it to a user,
// encrypt it, etc.
// FIXME: #Component will not match embedded scalars.
// use Runtime.isComponent() for a reliable check
#Component: {
// Match structs
#dagger: #ComponentConfig
...
} | {
// Match embedded strings
// FIXME: match all embedded scalar types
string
#dagger: #ComponentConfig
}
// The contents of a #dagger annotation
@ -65,7 +69,7 @@ package dagger
#Local: {
do: "local"
dir: string
include?: [...string] | *[]
include: [...string] | *[]
}
// FIXME: bring back load (more efficient than copy)
@ -81,17 +85,17 @@ package dagger
env?: [string]: string
always?: true | *false
dir: string | *"/"
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
mount: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
}
#MountTmp: "tmpfs"
#MountCache: "cache"
#MountComponent: {
input: #Component
from: #Component
path: string | *"/"
}
#MountScript: {
input: #Script
from: #Script
path: string | *"/"
}
@ -112,8 +116,3 @@ package dagger
src: string | *"/"
dest: string | *"/"
}
#TestScript: #Script & [
{do: "fetch-container", ref: "alpine:latest"},
{do: "exec", args: ["echo", "hello", "world"]},
]

View File

@ -21,6 +21,26 @@ www: {
#dagger: compute: _
}
// List the contents of the source directory
listing: {
string
#dagger: compute: [
dagger.#Load & {
from: base
},
dagger.#Exec & {
args: ["sh", "-c", "ls /src > /tmp/out"]
mount: "/src": {
from: source
}
},
dagger.#Export & {
source: "/tmp/out"
}
]
}
host: string
url: {
@ -30,12 +50,9 @@ www: {
dagger.#Load & { from: base },
dagger.#Exec & {
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"
source: "/tmp/out"
},
]
}