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 ./examples/tests/test-test.sh 2>/dev/null
# Actual integration tests # Actual integration tests
DAGGER_BINARY="./cmd/dagger/dagger-debug" time ./examples/tests/test.sh all 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, // by scripts defining how to compute it, present it to a user,
// encrypt it, etc. // encrypt it, etc.
// FIXME: #Component will not match embedded scalars.
// use Runtime.isComponent() for a reliable check
#Component: { #Component: {
// Match structs
#dagger: #ComponentConfig #dagger: #ComponentConfig
... ...
} | {
// Match embedded strings
// FIXME: match all embedded scalar types
string
#dagger: #ComponentConfig
} }
// The contents of a #dagger annotation // The contents of a #dagger annotation
@ -65,7 +69,7 @@ package dagger
#Local: { #Local: {
do: "local" do: "local"
dir: string dir: string
include?: [...string] | *[] include: [...string] | *[]
} }
// FIXME: bring back load (more efficient than copy) // FIXME: bring back load (more efficient than copy)
@ -81,17 +85,17 @@ package dagger
env?: [string]: string env?: [string]: string
always?: true | *false always?: true | *false
dir: string | *"/" dir: string | *"/"
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript mount: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
} }
#MountTmp: "tmpfs" #MountTmp: "tmpfs"
#MountCache: "cache" #MountCache: "cache"
#MountComponent: { #MountComponent: {
input: #Component from: #Component
path: string | *"/" path: string | *"/"
} }
#MountScript: { #MountScript: {
input: #Script from: #Script
path: string | *"/" path: string | *"/"
} }
@ -107,13 +111,8 @@ package dagger
} }
#Copy: { #Copy: {
do: "copy" do: "copy"
from: #Script | #Component from: #Script | #Component
src: string | *"/" src: string | *"/"
dest: 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: _ #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 host: string
url: { url: {
@ -30,12 +50,9 @@ www: {
dagger.#Load & { from: base }, dagger.#Load & { from: base },
dagger.#Exec & { dagger.#Exec & {
args: ["sh", "-c", "echo -n 'https://\(host)/foo' > /tmp/out"] args: ["sh", "-c", "echo -n 'https://\(host)/foo' > /tmp/out"]
// https://github.com/blocklayerhq/dagger/issues/6
mount: foo: {}
}, },
dagger.#Export & { dagger.#Export & {
// https://github.com/blocklayerhq/dagger/issues/8 source: "/tmp/out"
// source: "/tmp/out"
}, },
] ]
} }