Move types and plan back to main dagger package
Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
parent
b3bdd347e7
commit
5abd77f4f2
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/bash"
|
"universe.dagger.io/bash"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ dagger.#Plan & {
|
|||||||
_mountGoCache: {
|
_mountGoCache: {
|
||||||
mounts: "go mod cache": {
|
mounts: "go mod cache": {
|
||||||
dest: "/root/.gocache"
|
dest: "/root/.gocache"
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
id: "go mod cache"
|
id: "go mod cache"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
|
import "dagger.io/dagger"
|
||||||
|
|
||||||
// Execute a command in a container
|
// Execute a command in a container
|
||||||
#Exec: {
|
#Exec: {
|
||||||
$dagger: task: _name: "Exec"
|
$dagger: task: _name: "Exec"
|
||||||
|
|
||||||
// Container filesystem
|
// Container filesystem
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
|
|
||||||
// Transient filesystem mounts
|
// Transient filesystem mounts
|
||||||
// Key is an arbitrary name, for example "app source code"
|
// Key is an arbitrary name, for example "app source code"
|
||||||
@ -17,7 +19,7 @@ package core
|
|||||||
args: [...string]
|
args: [...string]
|
||||||
|
|
||||||
// Environment variables
|
// Environment variables
|
||||||
env: [key=string]: string | #Secret
|
env: [key=string]: string | dagger.#Secret
|
||||||
|
|
||||||
// Working directory
|
// Working directory
|
||||||
workdir: string | *"/"
|
workdir: string | *"/"
|
||||||
@ -33,7 +35,7 @@ package core
|
|||||||
hosts: [hostname=string]: string
|
hosts: [hostname=string]: string
|
||||||
|
|
||||||
// Modified filesystem
|
// Modified filesystem
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
|
|
||||||
// Command exit code
|
// Command exit code
|
||||||
// Currently this field can only ever be zero.
|
// Currently this field can only ever be zero.
|
||||||
@ -54,15 +56,15 @@ package core
|
|||||||
contents: #TempDir
|
contents: #TempDir
|
||||||
} | {
|
} | {
|
||||||
type: "service"
|
type: "service"
|
||||||
contents: #Service
|
contents: dagger.#Service
|
||||||
} | {
|
} | {
|
||||||
type: "fs"
|
type: "fs"
|
||||||
contents: #FS
|
contents: dagger.#FS
|
||||||
source?: string
|
source?: string
|
||||||
ro?: true | *false
|
ro?: true | *false
|
||||||
} | {
|
} | {
|
||||||
type: "secret"
|
type: "secret"
|
||||||
contents: #Secret
|
contents: dagger.#Secret
|
||||||
uid: int | *0
|
uid: int | *0
|
||||||
gid: int | *0
|
gid: int | *0
|
||||||
mask: int | *0o400
|
mask: int | *0o400
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
|
import "dagger.io/dagger"
|
||||||
|
|
||||||
// Access the source directory for the current CUE package
|
// Access the source directory for the current CUE package
|
||||||
// This may safely be called from any package
|
// This may safely be called from any package
|
||||||
#Source: {
|
#Source: {
|
||||||
@ -12,7 +14,7 @@ package core
|
|||||||
// Optionally include certain files
|
// Optionally include certain files
|
||||||
exclude: [...string]
|
exclude: [...string]
|
||||||
|
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create one or multiple directory in a container
|
// Create one or multiple directory in a container
|
||||||
@ -20,7 +22,7 @@ package core
|
|||||||
$dagger: task: _name: "Mkdir"
|
$dagger: task: _name: "Mkdir"
|
||||||
|
|
||||||
// Container filesystem
|
// Container filesystem
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
|
|
||||||
// Path of the directory to create
|
// Path of the directory to create
|
||||||
// It can be nested (e.g : "/foo" or "/foo/bar")
|
// It can be nested (e.g : "/foo" or "/foo/bar")
|
||||||
@ -33,14 +35,14 @@ package core
|
|||||||
parents: *true | false
|
parents: *true | false
|
||||||
|
|
||||||
// Modified filesystem
|
// Modified filesystem
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
|
||||||
#ReadFile: {
|
#ReadFile: {
|
||||||
$dagger: task: _name: "ReadFile"
|
$dagger: task: _name: "ReadFile"
|
||||||
|
|
||||||
// Filesystem tree holding the file
|
// Filesystem tree holding the file
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
// Path of the file to read
|
// Path of the file to read
|
||||||
path: string
|
path: string
|
||||||
// Contents of the file
|
// Contents of the file
|
||||||
@ -52,7 +54,7 @@ package core
|
|||||||
$dagger: task: _name: "WriteFile"
|
$dagger: task: _name: "WriteFile"
|
||||||
|
|
||||||
// Input filesystem tree
|
// Input filesystem tree
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
// Path of the file to write
|
// Path of the file to write
|
||||||
path: string
|
path: string
|
||||||
// Contents to write
|
// Contents to write
|
||||||
@ -60,27 +62,27 @@ package core
|
|||||||
// Permissions of the file
|
// Permissions of the file
|
||||||
permissions: *0o600 | int
|
permissions: *0o600 | int
|
||||||
// Output filesystem tree
|
// Output filesystem tree
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy files from one FS tree to another
|
// Copy files from one FS tree to another
|
||||||
#Copy: {
|
#Copy: {
|
||||||
$dagger: task: _name: "Copy"
|
$dagger: task: _name: "Copy"
|
||||||
// Input of the operation
|
// Input of the operation
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
// Contents to copy
|
// Contents to copy
|
||||||
contents: #FS
|
contents: dagger.#FS
|
||||||
// Source path (optional)
|
// Source path (optional)
|
||||||
source: string | *"/"
|
source: string | *"/"
|
||||||
// Destination path (optional)
|
// Destination path (optional)
|
||||||
dest: string | *"/"
|
dest: string | *"/"
|
||||||
// Output of the operation
|
// Output of the operation
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
|
||||||
#CopyInfo: {
|
#CopyInfo: {
|
||||||
source: {
|
source: {
|
||||||
root: #FS
|
root: dagger.#FS
|
||||||
path: string | *"/"
|
path: string | *"/"
|
||||||
}
|
}
|
||||||
dest: string
|
dest: string
|
||||||
@ -89,22 +91,22 @@ package core
|
|||||||
// Merge multiple FS trees into one
|
// Merge multiple FS trees into one
|
||||||
#Merge: {
|
#Merge: {
|
||||||
$dagger: task: _name: "Merge"
|
$dagger: task: _name: "Merge"
|
||||||
inputs: [...#FS]
|
inputs: [...dagger.#FS]
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the difference from lower FS to upper FS as its own FS
|
// Extract the difference from lower FS to upper FS as its own FS
|
||||||
#Diff: {
|
#Diff: {
|
||||||
$dagger: task: _name: "Diff"
|
$dagger: task: _name: "Diff"
|
||||||
lower: #FS
|
lower: dagger.#FS
|
||||||
upper: #FS
|
upper: dagger.#FS
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select a subdirectory from a filesystem tree
|
// Select a subdirectory from a filesystem tree
|
||||||
#Subdir: {
|
#Subdir: {
|
||||||
// Input tree
|
// Input tree
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
|
|
||||||
// Path of the subdirectory
|
// Path of the subdirectory
|
||||||
// Example: "/build"
|
// Example: "/build"
|
||||||
@ -112,12 +114,12 @@ package core
|
|||||||
|
|
||||||
// Copy action
|
// Copy action
|
||||||
_copy: #Copy & {
|
_copy: #Copy & {
|
||||||
"input": #Scratch
|
"input": dagger.#Scratch
|
||||||
contents: input
|
contents: input
|
||||||
source: path
|
source: path
|
||||||
dest: "/"
|
dest: "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subdirectory tree
|
// Subdirectory tree
|
||||||
output: #FS & _copy.output
|
output: dagger.#FS & _copy.output
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
|
import "dagger.io/dagger"
|
||||||
|
|
||||||
// Push a directory to a git remote
|
// Push a directory to a git remote
|
||||||
#GitPush: {
|
#GitPush: {
|
||||||
@dagger(notimplemented)
|
@dagger(notimplemented)
|
||||||
$dagger: task: _name: "GitPush"
|
$dagger: task: _name: "GitPush"
|
||||||
|
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
remote: string
|
remote: string
|
||||||
ref: string
|
ref: string
|
||||||
}
|
}
|
||||||
@ -20,11 +22,11 @@ package core
|
|||||||
keepGitDir: true | *false
|
keepGitDir: true | *false
|
||||||
auth?: {
|
auth?: {
|
||||||
username: string
|
username: string
|
||||||
password: #Secret // can be password or personal access token
|
password: dagger.#Secret // can be password or personal access token
|
||||||
} | {
|
} | {
|
||||||
authToken: #Secret
|
authToken: dagger.#Secret
|
||||||
} | {
|
} | {
|
||||||
authHeader: #Secret
|
authHeader: dagger.#Secret
|
||||||
}
|
}
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ package core
|
|||||||
// func Chown(uid, gid int) HTTPOption
|
// func Chown(uid, gid int) HTTPOption
|
||||||
// func Filename(name string) HTTPOption
|
// func Filename(name string) HTTPOption
|
||||||
|
|
||||||
|
import "dagger.io/dagger"
|
||||||
|
|
||||||
// Fetch a file over HTTP
|
// Fetch a file over HTTP
|
||||||
#HTTPFetch: {
|
#HTTPFetch: {
|
||||||
$dagger: task: _name: "HTTPFetch"
|
$dagger: task: _name: "HTTPFetch"
|
||||||
@ -43,5 +45,5 @@ package core
|
|||||||
gid?: int
|
gid?: int
|
||||||
|
|
||||||
// New filesystem state containing the downloaded file
|
// New filesystem state containing the downloaded file
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
@ -1,63 +1,31 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import "list"
|
import (
|
||||||
|
"list"
|
||||||
// A ref is an address for a remote container image
|
"dagger.io/dagger"
|
||||||
//
|
)
|
||||||
// Examples:
|
|
||||||
// - "index.docker.io/dagger"
|
|
||||||
// - "dagger"
|
|
||||||
// - "index.docker.io/dagger:latest"
|
|
||||||
// - "index.docker.io/dagger:latest@sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe"
|
|
||||||
#Ref: string
|
|
||||||
|
|
||||||
// Container image config. See [OCI](https://www.opencontainers.org/).
|
|
||||||
#ImageConfig: {
|
|
||||||
user?: string
|
|
||||||
expose?: [string]: {}
|
|
||||||
env?: [string]: string
|
|
||||||
entrypoint?: [...string]
|
|
||||||
cmd?: [...string]
|
|
||||||
volume?: [string]: {}
|
|
||||||
workdir?: string
|
|
||||||
label?: [string]: string
|
|
||||||
stopsignal?: string
|
|
||||||
healthcheck?: #HealthCheck
|
|
||||||
argsescaped?: bool
|
|
||||||
onbuild?: [...string]
|
|
||||||
stoptimeout?: int
|
|
||||||
shell?: [...string]
|
|
||||||
}
|
|
||||||
|
|
||||||
#HealthCheck: {
|
|
||||||
test?: [...string]
|
|
||||||
interval?: int
|
|
||||||
timeout?: int
|
|
||||||
startperiod?: int
|
|
||||||
retries?: int
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upload a container image to a remote repository
|
// Upload a container image to a remote repository
|
||||||
#Push: {
|
#Push: {
|
||||||
$dagger: task: _name: "Push"
|
$dagger: task: _name: "Push"
|
||||||
|
|
||||||
// Target repository address
|
// Target repository address
|
||||||
dest: #Ref
|
dest: dagger.#Ref
|
||||||
|
|
||||||
// Filesystem contents to push
|
// Filesystem contents to push
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
|
|
||||||
// Container image config
|
// Container image config
|
||||||
config: #ImageConfig
|
config: dagger.#ImageConfig
|
||||||
|
|
||||||
// Authentication
|
// Authentication
|
||||||
auth?: {
|
auth?: {
|
||||||
username: string
|
username: string
|
||||||
secret: #Secret
|
secret: dagger.#Secret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complete ref of the pushed image, including digest
|
// Complete ref of the pushed image, including digest
|
||||||
result: #Ref
|
result: dagger.#Ref
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download a container image from a remote repository
|
// Download a container image from a remote repository
|
||||||
@ -65,22 +33,22 @@ import "list"
|
|||||||
$dagger: task: _name: "Pull"
|
$dagger: task: _name: "Pull"
|
||||||
|
|
||||||
// Repository source ref
|
// Repository source ref
|
||||||
source: #Ref
|
source: dagger.#Ref
|
||||||
|
|
||||||
// Authentication
|
// Authentication
|
||||||
auth?: {
|
auth?: {
|
||||||
username: string
|
username: string
|
||||||
secret: #Secret
|
secret: dagger.#Secret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Root filesystem of downloaded image
|
// Root filesystem of downloaded image
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
|
|
||||||
// Image digest
|
// Image digest
|
||||||
digest: string
|
digest: string
|
||||||
|
|
||||||
// Downloaded container image config
|
// Downloaded container image config
|
||||||
config: #ImageConfig
|
config: dagger.#ImageConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a container image using a Dockerfile
|
// Build a container image using a Dockerfile
|
||||||
@ -88,7 +56,7 @@ import "list"
|
|||||||
$dagger: task: _name: "Dockerfile"
|
$dagger: task: _name: "Dockerfile"
|
||||||
|
|
||||||
// Source directory to build
|
// Source directory to build
|
||||||
source: #FS
|
source: dagger.#FS
|
||||||
|
|
||||||
dockerfile: *{
|
dockerfile: *{
|
||||||
path: string | *"Dockerfile"
|
path: string | *"Dockerfile"
|
||||||
@ -99,7 +67,7 @@ import "list"
|
|||||||
// Authentication
|
// Authentication
|
||||||
auth: [registry=string]: {
|
auth: [registry=string]: {
|
||||||
username: string
|
username: string
|
||||||
secret: #Secret
|
secret: dagger.#Secret
|
||||||
}
|
}
|
||||||
|
|
||||||
platforms?: [...string]
|
platforms?: [...string]
|
||||||
@ -109,10 +77,10 @@ import "list"
|
|||||||
hosts?: [string]: string
|
hosts?: [string]: string
|
||||||
|
|
||||||
// Root filesystem produced
|
// Root filesystem produced
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
|
|
||||||
// Container image config produced
|
// Container image config produced
|
||||||
config: #ImageConfig
|
config: dagger.#ImageConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export an image as a tar archive
|
// Export an image as a tar archive
|
||||||
@ -120,10 +88,10 @@ import "list"
|
|||||||
$dagger: task: _name: "Export"
|
$dagger: task: _name: "Export"
|
||||||
|
|
||||||
// Filesystem contents to export
|
// Filesystem contents to export
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
|
|
||||||
// Container image config
|
// Container image config
|
||||||
config: #ImageConfig
|
config: dagger.#ImageConfig
|
||||||
|
|
||||||
// Name and optionally a tag in the 'name:tag' format
|
// Name and optionally a tag in the 'name:tag' format
|
||||||
tag: string
|
tag: string
|
||||||
@ -138,19 +106,19 @@ import "list"
|
|||||||
imageID: string
|
imageID: string
|
||||||
|
|
||||||
// Root filesystem with exported file
|
// Root filesystem with exported file
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change image config
|
// Change image config
|
||||||
#Set: {
|
#Set: {
|
||||||
// The source image config
|
// The source image config
|
||||||
input: #ImageConfig
|
input: dagger.#ImageConfig
|
||||||
|
|
||||||
// The config to merge
|
// The config to merge
|
||||||
config: #ImageConfig
|
config: dagger.#ImageConfig
|
||||||
|
|
||||||
// Resulting config
|
// Resulting config
|
||||||
output: #ImageConfig & {
|
output: dagger.#ImageConfig & {
|
||||||
let structs = ["env", "label", "volume", "expose"]
|
let structs = ["env", "label", "volume", "expose"]
|
||||||
let lists = ["onbuild"]
|
let lists = ["onbuild"]
|
||||||
|
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
|
import "dagger.io/dagger"
|
||||||
|
|
||||||
// Decode the contents of a secrets without leaking it.
|
// Decode the contents of a secrets without leaking it.
|
||||||
// Supported formats: json, yaml
|
// Supported formats: json, yaml
|
||||||
#DecodeSecret: {
|
#DecodeSecret: {
|
||||||
$dagger: task: _name: "DecodeSecret"
|
$dagger: task: _name: "DecodeSecret"
|
||||||
|
|
||||||
// A #Secret whose plain text is a JSON or YAML string
|
// A dagger.#Secret whose plain text is a JSON or YAML string
|
||||||
input: #Secret
|
input: dagger.#Secret
|
||||||
|
|
||||||
format: "json" | "yaml"
|
format: "json" | "yaml"
|
||||||
|
|
||||||
// A new secret or (map of secrets) derived from unmarshaling the input secret's plain text
|
// A new secret or (map of secrets) derived from unmarshaling the input secret's plain text
|
||||||
output: #Secret | {[string]: output}
|
output: dagger.#Secret | {[string]: output}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new a secret from a filesystem tree
|
// Create a new a secret from a filesystem tree
|
||||||
@ -19,13 +21,13 @@ package core
|
|||||||
$dagger: task: _name: "NewSecret"
|
$dagger: task: _name: "NewSecret"
|
||||||
|
|
||||||
// Filesystem tree holding the secret
|
// Filesystem tree holding the secret
|
||||||
input: #FS
|
input: dagger.#FS
|
||||||
// Path of the secret to read
|
// Path of the secret to read
|
||||||
path: string
|
path: string
|
||||||
// Whether to trim leading and trailing space characters from secret value
|
// Whether to trim leading and trailing space characters from secret value
|
||||||
trimSpace: *true | false
|
trimSpace: *true | false
|
||||||
// Contents of the secret
|
// Contents of the secret
|
||||||
output: #Secret
|
output: dagger.#Secret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim leading and trailing space characters from a secret
|
// Trim leading and trailing space characters from a secret
|
||||||
@ -33,8 +35,8 @@ package core
|
|||||||
$dagger: task: _name: "TrimSecret"
|
$dagger: task: _name: "TrimSecret"
|
||||||
|
|
||||||
// Original secret
|
// Original secret
|
||||||
input: #Secret
|
input: dagger.#Secret
|
||||||
|
|
||||||
// New trimmed secret
|
// New trimmed secret
|
||||||
output: #Secret
|
output: dagger.#Secret
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package dagger
|
|
||||||
|
|
||||||
import "dagger.io/dagger/core"
|
|
||||||
|
|
||||||
#Plan: core.#Plan
|
|
||||||
|
|
||||||
// Types
|
|
||||||
|
|
||||||
#FS: core.#FS
|
|
||||||
#Scratch: core.#Scratch
|
|
||||||
#Secret: core.#Secret
|
|
||||||
#Service: core.#Service
|
|
||||||
|
|
||||||
#Address: core.#Address
|
|
||||||
|
|
||||||
// Image
|
|
||||||
|
|
||||||
#Ref: core.#Ref
|
|
||||||
#ImageConfig: core.#ImageConfig
|
|
||||||
|
|
||||||
#HealthCheck: core.#HealthCheck
|
|
||||||
|
|
||||||
// Mounts
|
|
||||||
|
|
||||||
#CacheDir: core.#CacheDir
|
|
||||||
#TempDir: core.#TempDir
|
|
36
pkg/dagger.io/dagger/image.cue
Normal file
36
pkg/dagger.io/dagger/image.cue
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package dagger
|
||||||
|
|
||||||
|
// A ref is an address for a remote container image
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
// - "index.docker.io/dagger"
|
||||||
|
// - "dagger"
|
||||||
|
// - "index.docker.io/dagger:latest"
|
||||||
|
// - "index.docker.io/dagger:latest@sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe"
|
||||||
|
#Ref: string
|
||||||
|
|
||||||
|
// Container image config. See [OCI](https://www.opencontainers.org/).
|
||||||
|
#ImageConfig: {
|
||||||
|
user?: string
|
||||||
|
expose?: [string]: {}
|
||||||
|
env?: [string]: string
|
||||||
|
entrypoint?: [...string]
|
||||||
|
cmd?: [...string]
|
||||||
|
volume?: [string]: {}
|
||||||
|
workdir?: string
|
||||||
|
label?: [string]: string
|
||||||
|
stopsignal?: string
|
||||||
|
healthcheck?: #HealthCheck
|
||||||
|
argsescaped?: bool
|
||||||
|
onbuild?: [...string]
|
||||||
|
stoptimeout?: int
|
||||||
|
shell?: [...string]
|
||||||
|
}
|
||||||
|
|
||||||
|
#HealthCheck: {
|
||||||
|
test?: [...string]
|
||||||
|
interval?: int
|
||||||
|
timeout?: int
|
||||||
|
startperiod?: int
|
||||||
|
retries?: int
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package core
|
package dagger
|
||||||
|
|
||||||
// A special kind of program which `dagger` can execute.
|
// A special kind of program which `dagger` can execute.
|
||||||
#Plan: {
|
#Plan: {
|
@ -1,4 +1,4 @@
|
|||||||
package core
|
package dagger
|
||||||
|
|
||||||
// A reference to a filesystem tree.
|
// A reference to a filesystem tree.
|
||||||
// For example:
|
// For example:
|
@ -31,7 +31,8 @@ var (
|
|||||||
UniverseModule,
|
UniverseModule,
|
||||||
}
|
}
|
||||||
|
|
||||||
DaggerPackage = fmt.Sprintf("%s/dagger/core", DaggerModule)
|
DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule)
|
||||||
|
DaggerCorePackage = fmt.Sprintf("%s/core", DaggerPackage)
|
||||||
|
|
||||||
lockFilePath = "dagger.lock"
|
lockFilePath = "dagger.lock"
|
||||||
)
|
)
|
||||||
|
@ -13,7 +13,7 @@ dagger.#Plan & {
|
|||||||
_nodeModulesMount: "/src/node_modules": {
|
_nodeModulesMount: "/src/node_modules": {
|
||||||
dest: "/src/node_modules"
|
dest: "/src/node_modules"
|
||||||
type: "cache"
|
type: "cache"
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
id: "todoapp-modules-cache"
|
id: "todoapp-modules-cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ dagger.#Plan & {
|
|||||||
"/cache/yarn": {
|
"/cache/yarn": {
|
||||||
dest: "/cache/yarn"
|
dest: "/cache/yarn"
|
||||||
type: "cache"
|
type: "cache"
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
id: "todoapp-yarn-cache"
|
id: "todoapp-yarn-cache"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package go
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ import (
|
|||||||
contents: source
|
contents: source
|
||||||
}
|
}
|
||||||
"go assets cache": {
|
"go assets cache": {
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
id: "\(name)_assets"
|
id: "\(name)_assets"
|
||||||
}
|
}
|
||||||
dest: _cachePath
|
dest: _cachePath
|
||||||
|
@ -20,6 +20,11 @@ var (
|
|||||||
cue.Str("$dagger"),
|
cue.Str("$dagger"),
|
||||||
cue.Str("task"),
|
cue.Str("task"),
|
||||||
cue.Hid("_name", pkg.DaggerPackage))
|
cue.Hid("_name", pkg.DaggerPackage))
|
||||||
|
corePath = cue.MakePath(
|
||||||
|
cue.Str("$dagger"),
|
||||||
|
cue.Str("task"),
|
||||||
|
cue.Hid("_name", pkg.DaggerCorePackage))
|
||||||
|
paths = []cue.Path{corePath, typePath}
|
||||||
)
|
)
|
||||||
|
|
||||||
// State is the state of the task.
|
// State is the state of the task.
|
||||||
@ -64,12 +69,7 @@ func Lookup(v *compiler.Value) (Task, error) {
|
|||||||
return nil, ErrNotTask
|
return nil, ErrNotTask
|
||||||
}
|
}
|
||||||
|
|
||||||
typ := v.LookupPath(typePath)
|
typeString, err := lookupType(v)
|
||||||
if !typ.Exists() {
|
|
||||||
return nil, ErrNotTask
|
|
||||||
}
|
|
||||||
|
|
||||||
typeString, err := typ.String()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -81,3 +81,13 @@ func Lookup(v *compiler.Value) (Task, error) {
|
|||||||
|
|
||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func lookupType(v *compiler.Value) (string, error) {
|
||||||
|
for _, path := range paths {
|
||||||
|
typ := v.LookupPath(path)
|
||||||
|
if typ.Exists() {
|
||||||
|
return typ.String()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "", ErrNotTask
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user