No more runtime spec validation

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
Solomon Hykes
2021-02-12 22:37:41 +00:00
parent ec56160307
commit e8527ddcf5
11 changed files with 209 additions and 410 deletions

View File

@@ -1,40 +1,9 @@
package dagger
// A dagger component is a configuration value augmented
// by scripts defining how to compute it, present it to a user,
// encrypt it, etc.
#ComputableStruct: {
#dagger: compute: [...#Op]
...
}
#ComputableString: {
string
#dagger: compute: [...#Op]
}
#Component: {
// Match structs
#dagger: #ComponentConfig
...
} | {
// Match embedded scalars
bool | int | float | string | bytes
#dagger: #ComponentConfig
}
// The contents of a #dagger annotation
#ComponentConfig: {
// script to compute the value
compute?: #Script
}
// Any component can be referenced as a directory, since
// every dagger script outputs a filesystem state (aka a directory)
#Dir: #Component
#Script: [...#Op]
#Dir: #dagger: compute: [...#Op]
// One operation in a script
#Op: #FetchContainer | #FetchGit | #Export | #Exec | #Local | #Copy | #Load | #Subdir
@@ -57,7 +26,7 @@ package dagger
#Load: {
do: "load"
from: #Component | #Script
from: _
}
#Subdir: {
@@ -71,18 +40,7 @@ package dagger
env?: [string]: string
always?: true | *false
dir: string | *"/"
mount: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
}
#MountTmp: "tmpfs"
#MountCache: "cache"
#MountComponent: {
from: #Component
path: string | *"/"
}
#MountScript: {
from: #Script
path: string | *"/"
mount: [string]: "tmp" | "cache" | { from: _, path: string | *"/" }
}
#FetchContainer: {
@@ -98,7 +56,7 @@ package dagger
#Copy: {
do: "copy"
from: #Script | #Component
from: _
src: string | *"/"
dest: string | *"/"
}

View File

@@ -6,12 +6,12 @@ import (
"dagger.cloud/dagger"
)
let alpine={
let alpine = {
digest: "sha256:3c7497bf0c7af93428242d6176e8f7905f2201d8fc5861f45be7a346b5f23436"
package: [string]: true | false | string
#dagger: compute: [
{
do: "fetch-container"
do: "fetch-container"
ref: "index.docker.io/alpine@\(digest)"
},
for pkg, info in package {
@@ -19,7 +19,7 @@ let alpine={
do: "exec"
args: ["apk", "add", "-U", "--no-cache", pkg]
}
if (info & string) != _|_ {
if (info & string) != _|_ {
do: "exec"
args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"]
}
@@ -41,13 +41,11 @@ www: {
},
dagger.#Exec & {
args: ["sh", "-c", "ls /src > /tmp/out"]
mount: "/src": {
from: source
}
mount: "/src": from: source
},
dagger.#Export & {
source: "/tmp/out"
}
},
]
}
@@ -58,7 +56,7 @@ www: {
#dagger: compute: [
{
do: "load"
do: "load"
from: alpine
},
dagger.#Exec & {