Merge pull request #1866 from helderco/dagger-core
Move core actions to `dagger/core` sub-package
This commit is contained in:
commit
4058d56f1b
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,13 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: "./src": read: contents: dagger.#FS
|
client: filesystem: "./src": read: contents: dagger.#FS
|
||||||
|
|
||||||
actions: build: dagger.#Dockerfile & {
|
actions: build: docker.#Dockerfile & {
|
||||||
// This is the context.
|
// This is the context.
|
||||||
source: client.filesystem."./src".read.contents
|
source: client.filesystem."./src".read.contents
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ dagger.#Plan & {
|
|||||||
run: bash.#Run & {
|
run: bash.#Run & {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
contents: dagger.#Subdir & {
|
contents: core.#Subdir & {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ dagger.#Plan & {
|
|||||||
contents: dagger.#Secret
|
contents: dagger.#Secret
|
||||||
}
|
}
|
||||||
actions: {
|
actions: {
|
||||||
registry: dagger.#TrimSecret & {
|
registry: core.#TrimSecret & {
|
||||||
input: client.filesystem.".registry".read.contents
|
input: client.filesystem.".registry".read.contents
|
||||||
}
|
}
|
||||||
pull: docker.#Pull & {
|
pull: docker.#Pull & {
|
||||||
|
@ -7,7 +7,7 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// Makes the yaml keys easily accessible
|
// Makes the yaml keys easily accessible
|
||||||
secrets: dagger.#DecodeSecret & {
|
secrets: core.#DecodeSecret & {
|
||||||
input: client.commands.sops.stdout
|
input: client.commands.sops.stdout
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ package particubes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ dagger.#Plan & {
|
|||||||
image: build.output
|
image: build.output
|
||||||
}
|
}
|
||||||
|
|
||||||
docsSecrets: dagger.#DecodeSecret & {
|
docsSecrets: core.#DecodeSecret & {
|
||||||
input: inputs.secrets.docs.contents
|
input: inputs.secrets.docs.contents
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package dagger
|
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 dagger
|
|||||||
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 dagger
|
|||||||
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 dagger
|
|||||||
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,4 +1,6 @@
|
|||||||
package dagger
|
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
|
||||||
@ -12,7 +14,7 @@ package dagger
|
|||||||
// 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 dagger
|
|||||||
$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 dagger
|
|||||||
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 dagger
|
|||||||
$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 dagger
|
|||||||
// 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 dagger
|
|||||||
// 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 dagger
|
|||||||
|
|
||||||
// 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 dagger
|
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 dagger
|
|||||||
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
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package dagger
|
package core
|
||||||
|
|
||||||
// HTTP operations
|
// HTTP operations
|
||||||
|
|
||||||
@ -16,6 +16,8 @@ package dagger
|
|||||||
// 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 dagger
|
|||||||
gid?: int
|
gid?: int
|
||||||
|
|
||||||
// New filesystem state containing the downloaded file
|
// New filesystem state containing the downloaded file
|
||||||
output: #FS
|
output: dagger.#FS
|
||||||
}
|
}
|
182
pkg/dagger.io/dagger/core/image.cue
Normal file
182
pkg/dagger.io/dagger/core/image.cue
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
"list"
|
||||||
|
"dagger.io/dagger"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Upload a container image to a remote repository
|
||||||
|
#Push: {
|
||||||
|
$dagger: task: _name: "Push"
|
||||||
|
|
||||||
|
// Target repository address
|
||||||
|
dest: dagger.#Ref
|
||||||
|
|
||||||
|
// Filesystem contents to push
|
||||||
|
input: dagger.#FS
|
||||||
|
|
||||||
|
// Container image config
|
||||||
|
config: dagger.#ImageConfig
|
||||||
|
|
||||||
|
// Authentication
|
||||||
|
auth?: {
|
||||||
|
username: string
|
||||||
|
secret: dagger.#Secret
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete ref of the pushed image, including digest
|
||||||
|
result: dagger.#Ref
|
||||||
|
}
|
||||||
|
|
||||||
|
// Download a container image from a remote repository
|
||||||
|
#Pull: {
|
||||||
|
$dagger: task: _name: "Pull"
|
||||||
|
|
||||||
|
// Repository source ref
|
||||||
|
source: dagger.#Ref
|
||||||
|
|
||||||
|
// Authentication
|
||||||
|
auth?: {
|
||||||
|
username: string
|
||||||
|
secret: dagger.#Secret
|
||||||
|
}
|
||||||
|
|
||||||
|
// Root filesystem of downloaded image
|
||||||
|
output: dagger.#FS
|
||||||
|
|
||||||
|
// Image digest
|
||||||
|
digest: string
|
||||||
|
|
||||||
|
// Downloaded container image config
|
||||||
|
config: dagger.#ImageConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a container image using a Dockerfile
|
||||||
|
#Dockerfile: {
|
||||||
|
$dagger: task: _name: "Dockerfile"
|
||||||
|
|
||||||
|
// Source directory to build
|
||||||
|
source: dagger.#FS
|
||||||
|
|
||||||
|
dockerfile: *{
|
||||||
|
path: string | *"Dockerfile"
|
||||||
|
} | {
|
||||||
|
contents: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authentication
|
||||||
|
auth: [registry=string]: {
|
||||||
|
username: string
|
||||||
|
secret: dagger.#Secret
|
||||||
|
}
|
||||||
|
|
||||||
|
platforms?: [...string]
|
||||||
|
target?: string
|
||||||
|
buildArg?: [string]: string
|
||||||
|
label?: [string]: string
|
||||||
|
hosts?: [string]: string
|
||||||
|
|
||||||
|
// Root filesystem produced
|
||||||
|
output: dagger.#FS
|
||||||
|
|
||||||
|
// Container image config produced
|
||||||
|
config: dagger.#ImageConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export an image as a tar archive
|
||||||
|
#Export: {
|
||||||
|
$dagger: task: _name: "Export"
|
||||||
|
|
||||||
|
// Filesystem contents to export
|
||||||
|
input: dagger.#FS
|
||||||
|
|
||||||
|
// Container image config
|
||||||
|
config: dagger.#ImageConfig
|
||||||
|
|
||||||
|
// Name and optionally a tag in the 'name:tag' format
|
||||||
|
tag: string
|
||||||
|
|
||||||
|
// Type of export
|
||||||
|
type: *"docker" | "oci"
|
||||||
|
|
||||||
|
// Path to the exported file inside `output`
|
||||||
|
path: string | *"/image.tar"
|
||||||
|
|
||||||
|
// Exported image ID
|
||||||
|
imageID: string
|
||||||
|
|
||||||
|
// Root filesystem with exported file
|
||||||
|
output: dagger.#FS
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change image config
|
||||||
|
#Set: {
|
||||||
|
// The source image config
|
||||||
|
input: dagger.#ImageConfig
|
||||||
|
|
||||||
|
// The config to merge
|
||||||
|
config: dagger.#ImageConfig
|
||||||
|
|
||||||
|
// Resulting config
|
||||||
|
output: dagger.#ImageConfig & {
|
||||||
|
let structs = ["env", "label", "volume", "expose"]
|
||||||
|
let lists = ["onbuild"]
|
||||||
|
|
||||||
|
// doesn't exist in config, copy away
|
||||||
|
for field, value in input if config[field] == _|_ {
|
||||||
|
"\(field)": value
|
||||||
|
}
|
||||||
|
|
||||||
|
// only exists in config, just copy as is
|
||||||
|
for field, value in config if input[field] == _|_ {
|
||||||
|
"\(field)": value
|
||||||
|
}
|
||||||
|
|
||||||
|
// these should exist in both places
|
||||||
|
for field, value in config if input[field] != _|_ {
|
||||||
|
"\(field)": {
|
||||||
|
// handle structs that need merging
|
||||||
|
if list.Contains(structs, field) {
|
||||||
|
_#mergeStructs & {
|
||||||
|
#a: input[field]
|
||||||
|
#b: config[field]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle lists that need concatenation
|
||||||
|
if list.Contains(lists, field) {
|
||||||
|
list.Concat([
|
||||||
|
input[field],
|
||||||
|
config[field],
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace anything else
|
||||||
|
if !list.Contains(structs+lists, field) {
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge two structs by overwriting or adding values
|
||||||
|
_#mergeStructs: {
|
||||||
|
// Struct with defaults
|
||||||
|
#a: [string]: _
|
||||||
|
|
||||||
|
// Struct with overrides
|
||||||
|
#b: [string]: _
|
||||||
|
{
|
||||||
|
// FIXME: we need exists() in if because this matches any kind of error (cue-lang/cue#943)
|
||||||
|
// add anything not in b
|
||||||
|
for field, value in #a if #b[field] == _|_ {
|
||||||
|
"\(field)": value
|
||||||
|
}
|
||||||
|
|
||||||
|
// safely add all of b
|
||||||
|
for field, value in #b {
|
||||||
|
"\(field)": value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package dagger
|
package core
|
||||||
|
|
||||||
// A core action that does nothing
|
// A core action that does nothing
|
||||||
// Useful to work around bugs in the DAG resolver.
|
// Useful to work around bugs in the DAG resolver.
|
@ -1,17 +1,19 @@
|
|||||||
package dagger
|
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 dagger
|
|||||||
$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 dagger
|
|||||||
$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,32 +1,5 @@
|
|||||||
package dagger
|
package dagger
|
||||||
|
|
||||||
import (
|
|
||||||
"list"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Upload a container image to a remote repository
|
|
||||||
#Push: {
|
|
||||||
$dagger: task: _name: "Push"
|
|
||||||
|
|
||||||
// Target repository address
|
|
||||||
dest: #Ref
|
|
||||||
|
|
||||||
// Filesystem contents to push
|
|
||||||
input: #FS
|
|
||||||
|
|
||||||
// Container image config
|
|
||||||
config: #ImageConfig
|
|
||||||
|
|
||||||
// Authentication
|
|
||||||
auth?: {
|
|
||||||
username: string
|
|
||||||
secret: #Secret
|
|
||||||
}
|
|
||||||
|
|
||||||
// Complete ref of the pushed image, including digest
|
|
||||||
result: #Ref
|
|
||||||
}
|
|
||||||
|
|
||||||
// A ref is an address for a remote container image
|
// A ref is an address for a remote container image
|
||||||
//
|
//
|
||||||
// Examples:
|
// Examples:
|
||||||
@ -61,156 +34,3 @@ import (
|
|||||||
startperiod?: int
|
startperiod?: int
|
||||||
retries?: int
|
retries?: int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download a container image from a remote repository
|
|
||||||
#Pull: {
|
|
||||||
$dagger: task: _name: "Pull"
|
|
||||||
|
|
||||||
// Repository source ref
|
|
||||||
source: #Ref
|
|
||||||
|
|
||||||
// Authentication
|
|
||||||
auth?: {
|
|
||||||
username: string
|
|
||||||
secret: #Secret
|
|
||||||
}
|
|
||||||
|
|
||||||
// Root filesystem of downloaded image
|
|
||||||
output: #FS
|
|
||||||
|
|
||||||
// Image digest
|
|
||||||
digest: string
|
|
||||||
|
|
||||||
// Downloaded container image config
|
|
||||||
config: #ImageConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build a container image using a Dockerfile
|
|
||||||
#Dockerfile: {
|
|
||||||
$dagger: task: _name: "Dockerfile"
|
|
||||||
|
|
||||||
// Source directory to build
|
|
||||||
source: #FS
|
|
||||||
|
|
||||||
dockerfile: *{
|
|
||||||
path: string | *"Dockerfile"
|
|
||||||
} | {
|
|
||||||
contents: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Authentication
|
|
||||||
auth: [registry=string]: {
|
|
||||||
username: string
|
|
||||||
secret: #Secret
|
|
||||||
}
|
|
||||||
|
|
||||||
platforms?: [...string]
|
|
||||||
target?: string
|
|
||||||
buildArg?: [string]: string
|
|
||||||
label?: [string]: string
|
|
||||||
hosts?: [string]: string
|
|
||||||
|
|
||||||
// Root filesystem produced
|
|
||||||
output: #FS
|
|
||||||
|
|
||||||
// Container image config produced
|
|
||||||
config: #ImageConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
// Export an image as a tar archive
|
|
||||||
#Export: {
|
|
||||||
$dagger: task: _name: "Export"
|
|
||||||
|
|
||||||
// Filesystem contents to export
|
|
||||||
input: #FS
|
|
||||||
|
|
||||||
// Container image config
|
|
||||||
config: #ImageConfig
|
|
||||||
|
|
||||||
// Name and optionally a tag in the 'name:tag' format
|
|
||||||
tag: string
|
|
||||||
|
|
||||||
// Type of export
|
|
||||||
type: *"docker" | "oci"
|
|
||||||
|
|
||||||
// Path to the exported file inside `output`
|
|
||||||
path: string | *"/image.tar"
|
|
||||||
|
|
||||||
// Exported image ID
|
|
||||||
imageID: string
|
|
||||||
|
|
||||||
// Root filesystem with exported file
|
|
||||||
output: #FS
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change image config
|
|
||||||
#Set: {
|
|
||||||
// The source image config
|
|
||||||
input: #ImageConfig
|
|
||||||
|
|
||||||
// The config to merge
|
|
||||||
config: #ImageConfig
|
|
||||||
|
|
||||||
// Resulting config
|
|
||||||
output: #ImageConfig & {
|
|
||||||
let structs = ["env", "label", "volume", "expose"]
|
|
||||||
let lists = ["onbuild"]
|
|
||||||
|
|
||||||
// doesn't exist in config, copy away
|
|
||||||
for field, value in input if config[field] == _|_ {
|
|
||||||
"\(field)": value
|
|
||||||
}
|
|
||||||
|
|
||||||
// only exists in config, just copy as is
|
|
||||||
for field, value in config if input[field] == _|_ {
|
|
||||||
"\(field)": value
|
|
||||||
}
|
|
||||||
|
|
||||||
// these should exist in both places
|
|
||||||
for field, value in config if input[field] != _|_ {
|
|
||||||
"\(field)": {
|
|
||||||
// handle structs that need merging
|
|
||||||
if list.Contains(structs, field) {
|
|
||||||
_#mergeStructs & {
|
|
||||||
#a: input[field]
|
|
||||||
#b: config[field]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle lists that need concatenation
|
|
||||||
if list.Contains(lists, field) {
|
|
||||||
list.Concat([
|
|
||||||
input[field],
|
|
||||||
config[field],
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
// replace anything else
|
|
||||||
if !list.Contains(structs+lists, field) {
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Merge two structs by overwriting or adding values
|
|
||||||
_#mergeStructs: {
|
|
||||||
// Struct with defaults
|
|
||||||
#a: [string]: _
|
|
||||||
|
|
||||||
// Struct with overrides
|
|
||||||
#b: [string]: _
|
|
||||||
{
|
|
||||||
// FIXME: we need exists() in if because this matches any kind of error (cue-lang/cue#943)
|
|
||||||
// add anything not in b
|
|
||||||
for field, value in #a if #b[field] == _|_ {
|
|
||||||
"\(field)": value
|
|
||||||
}
|
|
||||||
|
|
||||||
// safely add all of b
|
|
||||||
for field, value in #b {
|
|
||||||
"\(field)": value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -31,7 +31,8 @@ var (
|
|||||||
UniverseModule,
|
UniverseModule,
|
||||||
}
|
}
|
||||||
|
|
||||||
DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule)
|
DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule)
|
||||||
|
DaggerCorePackage = fmt.Sprintf("%s/core", DaggerPackage)
|
||||||
|
|
||||||
lockFilePath = "dagger.lock"
|
lockFilePath = "dagger.lock"
|
||||||
)
|
)
|
||||||
|
@ -2,6 +2,7 @@ package alpine
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
@ -16,7 +17,7 @@ dagger.#Plan & {
|
|||||||
version: "3.10.9"
|
version: "3.10.9"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Readfile & {
|
verify: core.#ReadFile & {
|
||||||
input: build.output.rootfs
|
input: build.output.rootfs
|
||||||
path: "/etc/alpine-release"
|
path: "/etc/alpine-release"
|
||||||
contents: "3.10.9\n"
|
contents: "3.10.9\n"
|
||||||
|
@ -3,6 +3,7 @@ package aws
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ import (
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
_scripts: dagger.#Source & {
|
_scripts: core.#Source & {
|
||||||
path: "_scripts"
|
path: "_scripts"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/aws"
|
"universe.dagger.io/aws"
|
||||||
"universe.dagger.io/aws/cli"
|
"universe.dagger.io/aws/cli"
|
||||||
)
|
)
|
||||||
@ -14,7 +15,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
sopsSecrets: dagger.#DecodeSecret & {
|
sopsSecrets: core.#DecodeSecret & {
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
input: client.commands.sops.stdout
|
input: client.commands.sops.stdout
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package test
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/aws"
|
"universe.dagger.io/aws"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
sopsSecrets: dagger.#DecodeSecret & {
|
sopsSecrets: core.#DecodeSecret & {
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
input: client.commands.sops.stdout
|
input: client.commands.sops.stdout
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package test
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/aws"
|
"universe.dagger.io/aws"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
sopsSecrets: dagger.#DecodeSecret & {
|
sopsSecrets: core.#DecodeSecret & {
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
input: client.commands.sops.stdout
|
input: client.commands.sops.stdout
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package bash
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
@ -26,7 +27,7 @@ import (
|
|||||||
contents: string
|
contents: string
|
||||||
|
|
||||||
_filename: "run.sh"
|
_filename: "run.sh"
|
||||||
_write: dagger.#WriteFile & {
|
_write: core.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: _filename
|
path: _filename
|
||||||
"contents": contents
|
"contents": contents
|
||||||
|
@ -2,6 +2,7 @@ package bash
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
"universe.dagger.io/bash"
|
"universe.dagger.io/bash"
|
||||||
@ -19,7 +20,7 @@ dagger.#Plan & {
|
|||||||
runFile: {
|
runFile: {
|
||||||
|
|
||||||
dir: _load.output
|
dir: _load.output
|
||||||
_load: dagger.#Source & {
|
_load: core.#Source & {
|
||||||
path: "./data"
|
path: "./data"
|
||||||
include: ["*.sh"]
|
include: ["*.sh"]
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Modular build API for Docker containers
|
// Modular build API for Docker containers
|
||||||
@ -46,7 +47,7 @@ import (
|
|||||||
dest: string | *"/"
|
dest: string | *"/"
|
||||||
|
|
||||||
// Execute copy operation
|
// Execute copy operation
|
||||||
_copy: dagger.#Copy & {
|
_copy: core.#Copy & {
|
||||||
"input": input.rootfs
|
"input": input.rootfs
|
||||||
"contents": contents
|
"contents": contents
|
||||||
"source": source
|
"source": source
|
||||||
@ -83,7 +84,7 @@ import (
|
|||||||
label: [string]: string
|
label: [string]: string
|
||||||
hosts: [string]: string
|
hosts: [string]: string
|
||||||
|
|
||||||
_build: dagger.#Dockerfile & {
|
_build: core.#Dockerfile & {
|
||||||
"source": source
|
"source": source
|
||||||
"auth": auth
|
"auth": auth
|
||||||
"dockerfile": dockerfile
|
"dockerfile": dockerfile
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ import (
|
|||||||
// Root filesystem with exported file
|
// Root filesystem with exported file
|
||||||
result: _export.output
|
result: _export.output
|
||||||
|
|
||||||
_export: dagger.#Export & {
|
_export: core.#Export & {
|
||||||
"tag": tag
|
"tag": tag
|
||||||
input: image.rootfs
|
input: image.rootfs
|
||||||
config: image.config
|
config: image.config
|
||||||
|
@ -3,6 +3,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Download an image from a remote registry
|
// Download an image from a remote registry
|
||||||
@ -16,7 +17,7 @@ import (
|
|||||||
secret: dagger.#Secret
|
secret: dagger.#Secret
|
||||||
}
|
}
|
||||||
|
|
||||||
_op: dagger.#Pull & {
|
_op: core.#Pull & {
|
||||||
"source": source
|
"source": source
|
||||||
if auth != _|_ {
|
if auth != _|_ {
|
||||||
"auth": auth
|
"auth": auth
|
||||||
|
@ -2,6 +2,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Upload an image to a remote repository
|
// Upload an image to a remote repository
|
||||||
@ -21,7 +22,7 @@ import (
|
|||||||
// Image to push
|
// Image to push
|
||||||
image: #Image
|
image: #Image
|
||||||
|
|
||||||
_push: dagger.#Push & {
|
_push: core.#Push & {
|
||||||
"dest": dest
|
"dest": dest
|
||||||
if auth != _|_ {
|
if auth != _|_ {
|
||||||
"auth": auth
|
"auth": auth
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"list"
|
"list"
|
||||||
|
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run a command in a container
|
// Run a command in a container
|
||||||
@ -14,7 +15,7 @@ import (
|
|||||||
always: bool | *false
|
always: bool | *false
|
||||||
|
|
||||||
// Filesystem mounts
|
// Filesystem mounts
|
||||||
mounts: [name=string]: dagger.#Mount
|
mounts: [name=string]: core.#Mount
|
||||||
|
|
||||||
// Expose network ports
|
// Expose network ports
|
||||||
// FIXME: investigate feasibility
|
// FIXME: investigate feasibility
|
||||||
@ -70,7 +71,7 @@ import (
|
|||||||
|
|
||||||
// Add defaults to image config
|
// Add defaults to image config
|
||||||
// This ensures these values are present
|
// This ensures these values are present
|
||||||
_defaults: dagger.#Set & {
|
_defaults: core.#Set & {
|
||||||
"input": {
|
"input": {
|
||||||
entrypoint: []
|
entrypoint: []
|
||||||
cmd: []
|
cmd: []
|
||||||
@ -81,7 +82,7 @@ import (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Override with user config
|
// Override with user config
|
||||||
_config: dagger.#Set & {
|
_config: core.#Set & {
|
||||||
input: _defaults.output
|
input: _defaults.output
|
||||||
config: {
|
config: {
|
||||||
if entrypoint != _|_ {
|
if entrypoint != _|_ {
|
||||||
@ -123,7 +124,7 @@ import (
|
|||||||
for path, _ in files {
|
for path, _ in files {
|
||||||
"\(path)": {
|
"\(path)": {
|
||||||
contents: string & _read.contents
|
contents: string & _read.contents
|
||||||
_read: dagger.#ReadFile & {
|
_read: core.#ReadFile & {
|
||||||
input: _exec.output
|
input: _exec.output
|
||||||
"path": path
|
"path": path
|
||||||
}
|
}
|
||||||
@ -139,7 +140,7 @@ import (
|
|||||||
for path, _ in directories {
|
for path, _ in directories {
|
||||||
"\(path)": {
|
"\(path)": {
|
||||||
contents: dagger.#FS & _subdir.output
|
contents: dagger.#FS & _subdir.output
|
||||||
_subdir: dagger.#Subdir & {
|
_subdir: core.#Subdir & {
|
||||||
input: _exec.output
|
input: _exec.output
|
||||||
"path": path
|
"path": path
|
||||||
}
|
}
|
||||||
@ -159,7 +160,7 @@ import (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actually execute the command
|
// Actually execute the command
|
||||||
_exec: dagger.#Exec & {
|
_exec: core.#Exec & {
|
||||||
"input": input.rootfs
|
"input": input.rootfs
|
||||||
"always": always
|
"always": always
|
||||||
"mounts": mounts
|
"mounts": mounts
|
||||||
@ -167,7 +168,7 @@ import (
|
|||||||
workdir: _config.output.workdir
|
workdir: _config.output.workdir
|
||||||
user: _config.output.user
|
user: _config.output.user
|
||||||
"env": env
|
"env": env
|
||||||
// env may contain secrets so we can't use dagger.#Set
|
// env may contain secrets so we can't use core.#Set
|
||||||
if input.config.env != _|_ {
|
if input.config.env != _|_ {
|
||||||
for key, val in input.config.env {
|
for key, val in input.config.env {
|
||||||
if env[key] == _|_ {
|
if env[key] == _|_ {
|
||||||
|
@ -2,6 +2,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Change image config
|
// Change image config
|
||||||
@ -12,7 +13,7 @@ import (
|
|||||||
// The image config to change
|
// The image config to change
|
||||||
config: dagger.#ImageConfig
|
config: dagger.#ImageConfig
|
||||||
|
|
||||||
_set: dagger.#Set & {
|
_set: core.#Set & {
|
||||||
"input": input.config
|
"input": input.config
|
||||||
"config": config
|
"config": config
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
@ -26,7 +27,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: image.output.rootfs
|
input: image.output.rootfs
|
||||||
path: "/test.txt"
|
path: "/test.txt"
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: image.output.rootfs
|
input: image.output.rootfs
|
||||||
path: "/test.txt"
|
path: "/test.txt"
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: build.output.rootfs
|
input: build.output.rootfs
|
||||||
path: "/test.txt"
|
path: "/test.txt"
|
||||||
} & {
|
} & {
|
||||||
@ -58,7 +59,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: build.output.rootfs
|
input: build.output.rootfs
|
||||||
path: "/test.txt"
|
path: "/test.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -2,6 +2,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
// Test: image config behavior is correct
|
// Test: image config behavior is correct
|
||||||
config: {
|
config: {
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: dagger.#Scratch
|
source: dagger.#Scratch
|
||||||
dockerfile: contents: """
|
dockerfile: contents: """
|
||||||
FROM alpine:3.15.0
|
FROM alpine:3.15.0
|
||||||
|
@ -2,6 +2,7 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
@ -24,7 +25,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: run.output.rootfs
|
input: run.output.rootfs
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ dagger.#Plan & {
|
|||||||
export: directories: "/test": _
|
export: directories: "/test": _
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: run.export.directories."/test"
|
input: run.export.directories."/test"
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,11 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
runtimeImage: dagger.#Pull & {
|
runtimeImage: core.#Pull & {
|
||||||
source: runtime_image_ref
|
source: runtime_image_ref
|
||||||
}
|
}
|
||||||
|
|
||||||
depsCache: dagger.#CacheDir & {
|
depsCache: core.#CacheDir & {
|
||||||
id: "depsCache"
|
id: "depsCache"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ dagger.#Plan & {
|
|||||||
contents: depsCache
|
contents: depsCache
|
||||||
}
|
}
|
||||||
|
|
||||||
buildCacheTest: dagger.#CacheDir & {
|
buildCacheTest: core.#CacheDir & {
|
||||||
id: "buildCacheTest"
|
id: "buildCacheTest"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ dagger.#Plan & {
|
|||||||
contents: buildCacheTest
|
contents: buildCacheTest
|
||||||
}
|
}
|
||||||
|
|
||||||
buildCacheProd: dagger.#CacheDir & {
|
buildCacheProd: core.#CacheDir & {
|
||||||
id: "buildCacheProd"
|
id: "buildCacheProd"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ dagger.#Plan & {
|
|||||||
contents: buildCacheProd
|
contents: buildCacheProd
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeModulesCache: dagger.#CacheDir & {
|
nodeModulesCache: core.#CacheDir & {
|
||||||
id: "nodeModulesCache"
|
id: "nodeModulesCache"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,20 +96,20 @@ dagger.#Plan & {
|
|||||||
contents: nodeModulesCache
|
contents: nodeModulesCache
|
||||||
}
|
}
|
||||||
|
|
||||||
appImage: dagger.#Copy & {
|
appImage: core.#Copy & {
|
||||||
input: runtimeImage.output
|
input: runtimeImage.output
|
||||||
contents: inputs.directories.app.contents
|
contents: inputs.directories.app.contents
|
||||||
dest: "/app"
|
dest: "/app"
|
||||||
}
|
}
|
||||||
|
|
||||||
deps: dagger.#Exec & {
|
deps: core.#Exec & {
|
||||||
input: appImage.output
|
input: appImage.output
|
||||||
mounts: depsCacheMount
|
mounts: depsCacheMount
|
||||||
workdir: "/app"
|
workdir: "/app"
|
||||||
args: ["bash", "-c", " mix deps.get"]
|
args: ["bash", "-c", " mix deps.get"]
|
||||||
}
|
}
|
||||||
|
|
||||||
assetsCompile: dagger.#Exec & {
|
assetsCompile: core.#Exec & {
|
||||||
input: depsCompileProd.output
|
input: depsCompileProd.output
|
||||||
mounts: depsCacheMount & nodeModulesCacheMount
|
mounts: depsCacheMount & nodeModulesCacheMount
|
||||||
workdir: "/app/assets"
|
workdir: "/app/assets"
|
||||||
@ -117,7 +117,7 @@ dagger.#Plan & {
|
|||||||
args: ["bash", "-c", "yarn install --frozen-lockfile && yarn run compile"]
|
args: ["bash", "-c", "yarn install --frozen-lockfile && yarn run compile"]
|
||||||
}
|
}
|
||||||
|
|
||||||
#depsCompile: dagger.#Exec & {
|
#depsCompile: core.#Exec & {
|
||||||
input: deps.output
|
input: deps.output
|
||||||
mounts: depsCacheMount
|
mounts: depsCacheMount
|
||||||
workdir: "/app"
|
workdir: "/app"
|
||||||
@ -134,7 +134,7 @@ dagger.#Plan & {
|
|||||||
mounts: buildCacheProdMount
|
mounts: buildCacheProdMount
|
||||||
}
|
}
|
||||||
|
|
||||||
assetsDigest: dagger.#Exec & {
|
assetsDigest: core.#Exec & {
|
||||||
input: assetsCompile.output
|
input: assetsCompile.output
|
||||||
mounts: depsCacheMount & buildCacheProdMount & nodeModulesCacheMount
|
mounts: depsCacheMount & buildCacheProdMount & nodeModulesCacheMount
|
||||||
env: MIX_ENV: "prod"
|
env: MIX_ENV: "prod"
|
||||||
@ -142,20 +142,20 @@ dagger.#Plan & {
|
|||||||
args: ["bash", "-c", "mix phx.digest"]
|
args: ["bash", "-c", "mix phx.digest"]
|
||||||
}
|
}
|
||||||
|
|
||||||
imageProdCacheCopy: dagger.#Exec & {
|
imageProdCacheCopy: core.#Exec & {
|
||||||
input: assetsDigest.output
|
input: assetsDigest.output
|
||||||
mounts: (depsCacheMount & {depsCache: dest: "/mnt/app/deps/"} )
|
mounts: (depsCacheMount & {depsCache: dest: "/mnt/app/deps/"} )
|
||||||
mounts: (buildCacheProdMount & {buildCacheProd: dest: "/mnt/app/_build/prod"} )
|
mounts: (buildCacheProdMount & {buildCacheProd: dest: "/mnt/app/_build/prod"} )
|
||||||
args: ["bash", "-c", "cp -Rp /mnt/app/deps/* /app/deps/ && cp -Rp /mnt/app/_build/prod/* /app/_build/prod/"]
|
args: ["bash", "-c", "cp -Rp /mnt/app/deps/* /app/deps/ && cp -Rp /mnt/app/_build/prod/* /app/_build/prod/"]
|
||||||
}
|
}
|
||||||
|
|
||||||
imageProdDockerCopy: dagger.#Copy & {
|
imageProdDockerCopy: core.#Copy & {
|
||||||
input: imageProdCacheCopy.output
|
input: imageProdCacheCopy.output
|
||||||
source: root: inputs.directories.docker.contents
|
source: root: inputs.directories.docker.contents
|
||||||
dest: "/"
|
dest: "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
imageProd: dagger.#Build & {
|
imageProd: core.#Dockerfile & {
|
||||||
source: imageProdDockerCopy.output
|
source: imageProdDockerCopy.output
|
||||||
dockerfile: path: "/docker/Dockerfile.production"
|
dockerfile: path: "/docker/Dockerfile.production"
|
||||||
buildArg: {
|
buildArg: {
|
||||||
|
@ -19,7 +19,7 @@ actions: {
|
|||||||
// workdir: _
|
// workdir: _
|
||||||
// // FIXME: remove copy-pasta
|
// // FIXME: remove copy-pasta
|
||||||
// mounts: nodeModules: {
|
// mounts: nodeModules: {
|
||||||
// contents: dagger.#CacheDir & {
|
// contents: core.#CacheDir & {
|
||||||
// // FIXME: do we need an ID here?
|
// // FIXME: do we need an ID here?
|
||||||
// id: "\(mix.app)_assets_node_modules"
|
// id: "\(mix.app)_assets_node_modules"
|
||||||
// // FIXME: does this command need write access to node_modules cache?
|
// // FIXME: does this command need write access to node_modules cache?
|
||||||
@ -55,7 +55,7 @@ actions: {
|
|||||||
// }
|
// }
|
||||||
// // FIXME: move this to a reusable def (yarn package? or private?)
|
// // FIXME: move this to a reusable def (yarn package? or private?)
|
||||||
// mounts: nodeModules: {
|
// mounts: nodeModules: {
|
||||||
// contents: dagger.#CacheDir & {
|
// contents: core.#CacheDir & {
|
||||||
// // FIXME: do we need an ID here?
|
// // FIXME: do we need an ID here?
|
||||||
// id: "\(mix.app)_assets_node_modules"
|
// id: "\(mix.app)_assets_node_modules"
|
||||||
// // FIXME: will there be multiple writers?
|
// // FIXME: will there be multiple writers?
|
||||||
|
@ -67,7 +67,7 @@ import (
|
|||||||
}
|
}
|
||||||
if cache.deps != null {
|
if cache.deps != null {
|
||||||
mounts: deps: {
|
mounts: deps: {
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
id: "\(app.name)_deps"
|
id: "\(app.name)_deps"
|
||||||
concurrency: cache.deps
|
concurrency: cache.deps
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ import (
|
|||||||
}
|
}
|
||||||
if cache.build != null {
|
if cache.build != null {
|
||||||
mounts: buildCache: {
|
mounts: buildCache: {
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
id: "\(app.name)_build_\(env)"
|
id: "\(app.name)_build_\(env)"
|
||||||
concurrency: cache.build
|
concurrency: cache.build
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package todoapp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
"universe.dagger.io/bash"
|
"universe.dagger.io/bash"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
@ -9,10 +10,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
_nodeModulesMount: "/src/node_modules": dagger.#Mount & {
|
_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"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,10 +54,10 @@ dagger.#Plan & {
|
|||||||
bash.#Run & {
|
bash.#Run & {
|
||||||
workdir: "/src"
|
workdir: "/src"
|
||||||
mounts: {
|
mounts: {
|
||||||
"/cache/yarn": dagger.#Mount & {
|
"/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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +90,7 @@ dagger.#Plan & {
|
|||||||
"""#
|
"""#
|
||||||
}
|
}
|
||||||
|
|
||||||
contents: dagger.#Subdir & {
|
contents: core.#Subdir & {
|
||||||
input: run.output.rootfs
|
input: run.output.rootfs
|
||||||
path: "/src/build"
|
path: "/src/build"
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package git
|
package git
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
#Pull: dagger.#GitPull
|
#Pull: core.#GitPull
|
||||||
#Push: dagger.#GitPush
|
#Push: core.#GitPush
|
||||||
|
@ -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
|
||||||
|
@ -2,6 +2,7 @@ package go
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/go"
|
"universe.dagger.io/go"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
@ -32,7 +33,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: exec.output.rootfs
|
input: exec.output.rootfs
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -4,6 +4,7 @@ package netlify
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
@ -60,7 +61,7 @@ import (
|
|||||||
container: bash.#Run & {
|
container: bash.#Run & {
|
||||||
input: *_build.output | docker.#Image
|
input: *_build.output | docker.#Image
|
||||||
script: {
|
script: {
|
||||||
_load: dagger.#Source & {
|
_load: core.#Source & {
|
||||||
path: "."
|
path: "."
|
||||||
include: ["*.sh"]
|
include: ["*.sh"]
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package netlify
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
"universe.dagger.io/netlify"
|
"universe.dagger.io/netlify"
|
||||||
@ -20,7 +21,7 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
// Configuration common to all tests
|
// Configuration common to all tests
|
||||||
common: {
|
common: {
|
||||||
testSecrets: dagger.#DecodeSecret & {
|
testSecrets: core.#DecodeSecret & {
|
||||||
input: client.commands.sops.stdout
|
input: client.commands.sops.stdout
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
}
|
}
|
||||||
@ -29,7 +30,7 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
marker: "hello world"
|
marker: "hello world"
|
||||||
|
|
||||||
data: dagger.#WriteFile & {
|
data: core.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: "index.html"
|
path: "index.html"
|
||||||
contents: marker
|
contents: marker
|
||||||
|
@ -3,6 +3,7 @@ package powershell
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ import (
|
|||||||
contents: string
|
contents: string
|
||||||
|
|
||||||
_filename: "run.ps1"
|
_filename: "run.ps1"
|
||||||
_write: dagger.#WriteFile & {
|
_write: core.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: _filename
|
path: _filename
|
||||||
"contents": contents
|
"contents": contents
|
||||||
|
@ -2,6 +2,7 @@ package powershell
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
"universe.dagger.io/powershell"
|
"universe.dagger.io/powershell"
|
||||||
@ -19,7 +20,7 @@ dagger.#Plan & {
|
|||||||
runFile: {
|
runFile: {
|
||||||
|
|
||||||
dir: _load.output
|
dir: _load.output
|
||||||
_load: dagger.#Source & {
|
_load: core.#Source & {
|
||||||
path: "./data"
|
path: "./data"
|
||||||
include: ["*.ps1"]
|
include: ["*.ps1"]
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package yarn
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/docker"
|
"universe.dagger.io/docker"
|
||||||
"universe.dagger.io/yarn"
|
"universe.dagger.io/yarn"
|
||||||
@ -78,7 +79,7 @@ dagger.#Plan & {
|
|||||||
path: string
|
path: string
|
||||||
contents: string
|
contents: string
|
||||||
|
|
||||||
_read: dagger.#ReadFile & {
|
_read: core.#ReadFile & {
|
||||||
"input": input
|
"input": input
|
||||||
"path": path
|
"path": path
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
|
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
"universe.dagger.io/bash"
|
"universe.dagger.io/bash"
|
||||||
@ -78,7 +79,7 @@ import (
|
|||||||
|
|
||||||
mounts: "yarn cache": {
|
mounts: "yarn cache": {
|
||||||
dest: "/cache/yarn"
|
dest: "/cache/yarn"
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
// FIXME: are there character limitations in cache ID?
|
// FIXME: are there character limitations in cache ID?
|
||||||
id: "universe.dagger.io/yarn.#Run \(name)"
|
id: "universe.dagger.io/yarn.#Run \(name)"
|
||||||
}
|
}
|
||||||
@ -109,7 +110,7 @@ import (
|
|||||||
|
|
||||||
mounts: "yarn cache": {
|
mounts: "yarn cache": {
|
||||||
dest: "/cache/yarn"
|
dest: "/cache/yarn"
|
||||||
contents: dagger.#CacheDir & {
|
contents: core.#CacheDir & {
|
||||||
// FIXME: are there character limitations in cache ID?
|
// FIXME: are there character limitations in cache ID?
|
||||||
id: "universe.dagger.io/yarn.#Run \(name)"
|
id: "universe.dagger.io/yarn.#Run \(name)"
|
||||||
}
|
}
|
||||||
@ -135,7 +136,7 @@ import (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The final contents of the package after run
|
// The final contents of the package after run
|
||||||
_output: dagger.#Subdir & {
|
_output: core.#Subdir & {
|
||||||
input: _run.output.rootfs
|
input: _run.output.rootfs
|
||||||
path: "/build"
|
path: "/build"
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
_source: dagger.#Source & {
|
_source: core.#Source & {
|
||||||
path: "."
|
path: "."
|
||||||
exclude: [
|
exclude: [
|
||||||
"ci",
|
"ci",
|
||||||
|
@ -36,6 +36,7 @@ setup() {
|
|||||||
assert_output --partial 'client.filesystem."./test_do".write'
|
assert_output --partial 'client.filesystem."./test_do".write'
|
||||||
refute_output --partial "actions.notMe"
|
refute_output --partial "actions.notMe"
|
||||||
refute_output --partial 'client.filesystem."./dependent_do".write'
|
refute_output --partial 'client.filesystem."./dependent_do".write'
|
||||||
|
rm -f ./test_do
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan/do: nice error message for 0.1.0 projects" {
|
@test "plan/do: nice error message for 0.1.0 projects" {
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -28,28 +29,28 @@ dagger.#Plan & {
|
|||||||
invalid: name: "foobar"
|
invalid: name: "foobar"
|
||||||
}
|
}
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
test: {
|
test: {
|
||||||
invalid: dagger.#Exec & {
|
invalid: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["echo", client.commands.invalid.stdout]
|
args: ["echo", client.commands.invalid.stdout]
|
||||||
}
|
}
|
||||||
valid: {
|
valid: {
|
||||||
normal: dagger.#Exec & {
|
normal: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["test", strings.TrimSpace(client.commands.normal.stdout), "=", "hello europa"]
|
args: ["test", strings.TrimSpace(client.commands.normal.stdout), "=", "hello europa"]
|
||||||
}
|
}
|
||||||
relative: dagger.#Exec & {
|
relative: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["test", strings.TrimSpace(client.commands.relative.stdout), "=", "test"]
|
args: ["test", strings.TrimSpace(client.commands.relative.stdout), "=", "test"]
|
||||||
}
|
}
|
||||||
error: dagger.#Exec & {
|
error: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["test", strings.TrimSpace(client.commands.error.stderr), "=", "error"]
|
args: ["test", strings.TrimSpace(client.commands.error.stderr), "=", "error"]
|
||||||
}
|
}
|
||||||
secret: dagger.#Exec & {
|
secret: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: secret: {
|
mounts: secret: {
|
||||||
dest: "/run/secrets/test"
|
dest: "/run/secrets/test"
|
||||||
|
5
tests/plan/client/env/concrete.cue
vendored
5
tests/plan/client/env/concrete.cue
vendored
@ -2,16 +2,17 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: env: TEST_FAIL: "env"
|
client: env: TEST_FAIL: "env"
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
test: dagger.#Exec & {
|
test: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: [client.env.TEST_FAIL]
|
args: [client.env.TEST_FAIL]
|
||||||
}
|
}
|
||||||
|
7
tests/plan/client/env/usage.cue
vendored
7
tests/plan/client/env/usage.cue
vendored
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -10,15 +11,15 @@ dagger.#Plan & {
|
|||||||
TEST_SECRET: dagger.#Secret
|
TEST_SECRET: dagger.#Secret
|
||||||
}
|
}
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
test: {
|
test: {
|
||||||
string: dagger.#Exec & {
|
string: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["test", client.env.TEST_STRING, "=", "foo"]
|
args: ["test", client.env.TEST_STRING, "=", "foo"]
|
||||||
}
|
}
|
||||||
secret: dagger.#Exec & {
|
secret: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: secret: {
|
mounts: secret: {
|
||||||
dest: "/run/secrets/test"
|
dest: "/run/secrets/test"
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -11,15 +12,15 @@ dagger.#Plan & {
|
|||||||
write: contents: actions.test.export.contents
|
write: contents: actions.test.export.contents
|
||||||
}
|
}
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
test: {
|
test: {
|
||||||
read: dagger.#Exec & {
|
read: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["echo", client.filesystem."test.txt".read.contents]
|
args: ["echo", client.filesystem."test.txt".read.contents]
|
||||||
}
|
}
|
||||||
write: dagger.#Exec & {
|
write: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["sh", "-c",
|
args: ["sh", "-c",
|
||||||
#"""
|
#"""
|
||||||
@ -27,7 +28,7 @@ dagger.#Plan & {
|
|||||||
"""#,
|
"""#,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
export: dagger.#ReadFile & {
|
export: core.#ReadFile & {
|
||||||
input: write.output
|
input: write.output
|
||||||
path: "out.txt"
|
path: "out.txt"
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -11,20 +12,20 @@ dagger.#Plan & {
|
|||||||
"secret.txt": read: contents: dagger.#Secret
|
"secret.txt": read: contents: dagger.#Secret
|
||||||
}
|
}
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
test: {
|
test: {
|
||||||
concrete: dagger.#Exec & {
|
concrete: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["sh", "-c", client.filesystem."cmd.sh".read.contents]
|
args: ["sh", "-c", client.filesystem."cmd.sh".read.contents]
|
||||||
}
|
}
|
||||||
usage: {
|
usage: {
|
||||||
string: dagger.#Exec & {
|
string: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["test", client.filesystem."test.txt".read.contents, "=", "foo"]
|
args: ["test", client.filesystem."test.txt".read.contents, "=", "foo"]
|
||||||
}
|
}
|
||||||
secret: dagger.#Exec & {
|
secret: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: secret: {
|
mounts: secret: {
|
||||||
dest: "/run/secrets/test"
|
dest: "/run/secrets/test"
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -10,7 +11,7 @@ dagger.#Plan & {
|
|||||||
include: ["*.txt"]
|
include: ["*.txt"]
|
||||||
}
|
}
|
||||||
actions: test: {
|
actions: test: {
|
||||||
[string]: dagger.#ReadFile & {
|
[string]: core.#ReadFile & {
|
||||||
input: client.filesystem."../rootfs".read.contents
|
input: client.filesystem."../rootfs".read.contents
|
||||||
}
|
}
|
||||||
valid: {
|
valid: {
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -10,7 +11,7 @@ dagger.#Plan & {
|
|||||||
exclude: ["*.log"]
|
exclude: ["*.log"]
|
||||||
}
|
}
|
||||||
actions: test: {
|
actions: test: {
|
||||||
[string]: dagger.#ReadFile & {
|
[string]: core.#ReadFile & {
|
||||||
input: client.filesystem.rootfs.read.contents
|
input: client.filesystem.rootfs.read.contents
|
||||||
}
|
}
|
||||||
valid: {
|
valid: {
|
||||||
|
@ -2,22 +2,23 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: "/var/run/docker.soc": read: contents: dagger.#Service
|
client: filesystem: "/var/run/docker.soc": read: contents: dagger.#Service
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
imageWithDocker: dagger.#Exec & {
|
imageWithDocker: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||||
}
|
}
|
||||||
|
|
||||||
test: dagger.#Exec & {
|
test: core.#Exec & {
|
||||||
input: imageWithDocker.output
|
input: imageWithDocker.output
|
||||||
mounts: docker: {
|
mounts: docker: {
|
||||||
dest: "/var/run/docker.sock"
|
dest: "/var/run/docker.sock"
|
||||||
|
@ -2,22 +2,23 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
|
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
imageWithDocker: dagger.#Exec & {
|
imageWithDocker: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||||
}
|
}
|
||||||
|
|
||||||
test: dagger.#Exec & {
|
test: core.#Exec & {
|
||||||
input: imageWithDocker.output
|
input: imageWithDocker.output
|
||||||
mounts: docker: {
|
mounts: docker: {
|
||||||
dest: "/var/run/docker.sock"
|
dest: "/var/run/docker.sock"
|
||||||
|
@ -2,22 +2,23 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: "//./pipe/docker_engine": read: contents: dagger.#Service
|
client: filesystem: "//./pipe/docker_engine": read: contents: dagger.#Service
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
imageWithDocker: dagger.#Exec & {
|
imageWithDocker: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||||
}
|
}
|
||||||
|
|
||||||
test: dagger.#Exec & {
|
test: core.#Exec & {
|
||||||
input: imageWithDocker.output
|
input: imageWithDocker.output
|
||||||
mounts: docker: {
|
mounts: docker: {
|
||||||
dest: "/var/run/docker.sock"
|
dest: "/var/run/docker.sock"
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -15,30 +16,30 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
test: {
|
test: {
|
||||||
fs: data: dagger.#WriteFile & {
|
fs: data: core.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: "/test"
|
path: "/test"
|
||||||
contents: "foobar"
|
contents: "foobar"
|
||||||
}
|
}
|
||||||
file: {
|
file: {
|
||||||
// Only using contents for reference in client
|
// Only using contents for reference in client
|
||||||
data: dagger.#WriteFile & {
|
data: core.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: "/test"
|
path: "/test"
|
||||||
contents: "foobaz"
|
contents: "foobaz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
secret: {
|
secret: {
|
||||||
create: dagger.#WriteFile & {
|
create: core.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: "/test"
|
path: "/test"
|
||||||
contents: "foo-barab-oof"
|
contents: "foo-barab-oof"
|
||||||
}
|
}
|
||||||
data: dagger.#NewSecret & {
|
data: core.#NewSecret & {
|
||||||
input: create.output
|
input: create.output
|
||||||
path: "/test"
|
path: "/test"
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,21 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
// "alpha.dagger.io/os"
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: test: {
|
actions: test: {
|
||||||
_image: dagger.#Pull & {
|
_image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
_exec: dagger.#Exec & {
|
_exec: core.#Exec & {
|
||||||
input: _image.output
|
input: _image.output
|
||||||
args: ["sh", "-c", "echo -n Hello Europa > /out.txt"]
|
args: ["sh", "-c", "echo -n Hello Europa > /out.txt"]
|
||||||
}
|
}
|
||||||
|
|
||||||
_verify: dagger.#ReadFile & {
|
_verify: core.#ReadFile & {
|
||||||
input: _exec.output
|
input: _exec.output
|
||||||
path: "/out.txt"
|
path: "/out.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
platform: "linux/unknown"
|
platform: "linux/unknown"
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0"
|
source: "alpine:3.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
writeArch: dagger.#Exec & {
|
writeArch: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
always: true
|
always: true
|
||||||
args: [
|
args: [
|
||||||
@ -21,7 +23,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: writeArch.output
|
input: writeArch.output
|
||||||
path: "/arch.txt"
|
path: "/arch.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
platform: "linux/amd64"
|
platform: "linux/amd64"
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0"
|
source: "alpine:3.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
writeArch: dagger.#Exec & {
|
writeArch: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
always: true
|
always: true
|
||||||
args: [
|
args: [
|
||||||
@ -21,7 +23,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: writeArch.output
|
input: writeArch.output
|
||||||
path: "/arch.txt"
|
path: "/arch.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
platform: "linux/arm64"
|
platform: "linux/arm64"
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0"
|
source: "alpine:3.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
writeArch: dagger.#Exec & {
|
writeArch: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
always: true
|
always: true
|
||||||
args: [
|
args: [
|
||||||
@ -21,7 +23,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: writeArch.output
|
input: writeArch.output
|
||||||
path: "/arch.txt"
|
path: "/arch.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -2,18 +2,19 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
params: foo: string
|
params: foo: string
|
||||||
|
|
||||||
_image: dagger.#Pull & {
|
_image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
[string]: dagger.#Exec & {
|
[string]: core.#Exec & {
|
||||||
input: _image.output
|
input: _image.output
|
||||||
env: FOO: string
|
env: FOO: string
|
||||||
args: [
|
args: [
|
||||||
|
@ -63,7 +63,7 @@ setup() {
|
|||||||
|
|
||||||
@test "task: #Dockerfile" {
|
@test "task: #Dockerfile" {
|
||||||
cd "$TESTDIR"/tasks/dockerfile
|
cd "$TESTDIR"/tasks/dockerfile
|
||||||
"$DAGGER" "do" -p ./dockerfile.cue
|
"$DAGGER" "do" -p ./dockerfile.cue verify
|
||||||
"$DAGGER" "do" -p ./inlined_dockerfile.cue verify
|
"$DAGGER" "do" -p ./inlined_dockerfile.cue verify
|
||||||
"$DAGGER" "do" -p ./inlined_dockerfile_heredoc.cue verify
|
"$DAGGER" "do" -p ./inlined_dockerfile_heredoc.cue verify
|
||||||
"$DAGGER" "do" -p ./dockerfile_path.cue verify
|
"$DAGGER" "do" -p ./dockerfile_path.cue verify
|
||||||
|
@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: dagger.#Exec & {
|
exec: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
@ -20,7 +21,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
test: {
|
test: {
|
||||||
verify_file: dagger.#ReadFile & {
|
verify_file: core.#ReadFile & {
|
||||||
input: exec.output
|
input: exec.output
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
} & {
|
} & {
|
||||||
@ -28,14 +29,14 @@ dagger.#Plan & {
|
|||||||
contents: "hello world"
|
contents: "hello world"
|
||||||
}
|
}
|
||||||
|
|
||||||
copy: dagger.#Copy & {
|
copy: core.#Copy & {
|
||||||
input: image.output
|
input: image.output
|
||||||
contents: exec.output
|
contents: exec.output
|
||||||
source: "/output.txt"
|
source: "/output.txt"
|
||||||
dest: "/output.txt"
|
dest: "/output.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_copy: dagger.#ReadFile & {
|
verify_copy: core.#ReadFile & {
|
||||||
input: copy.output
|
input: copy.output
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: dagger.#Exec & {
|
exec: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
@ -21,7 +22,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
verify_file: dagger.#ReadFile & {
|
verify_file: core.#ReadFile & {
|
||||||
input: exec.output
|
input: exec.output
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
} & {
|
} & {
|
||||||
@ -29,13 +30,13 @@ dagger.#Plan & {
|
|||||||
contents: "hello world from dagger"
|
contents: "hello world from dagger"
|
||||||
}
|
}
|
||||||
|
|
||||||
copy: dagger.#Copy & {
|
copy: core.#Copy & {
|
||||||
input: image.output
|
input: image.output
|
||||||
contents: exec.output
|
contents: exec.output
|
||||||
source: "/output.txt"
|
source: "/output.txt"
|
||||||
dest: "/output.txt"
|
dest: "/output.txt"
|
||||||
}
|
}
|
||||||
verify_copy: dagger.#ReadFile & {
|
verify_copy: core.#ReadFile & {
|
||||||
input: copy.output
|
input: copy.output
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -2,20 +2,21 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
alpine3_15_0: dagger.#Pull & {
|
alpine3_15_0: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
busybox1_34_1: dagger.#Pull & {
|
busybox1_34_1: core.#Pull & {
|
||||||
source: "busybox:1.34.1-glibc@sha256:ec98391b8f0911db08be2ee6c46813eeac17b9625b402ea1ce45dcfcd05d78d6"
|
source: "busybox:1.34.1-glibc@sha256:ec98391b8f0911db08be2ee6c46813eeac17b9625b402ea1ce45dcfcd05d78d6"
|
||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
verify_alpine_3_15_0: dagger.#ReadFile & {
|
verify_alpine_3_15_0: core.#ReadFile & {
|
||||||
input: alpine3_15_0.output
|
input: alpine3_15_0.output
|
||||||
path: "/etc/alpine-release"
|
path: "/etc/alpine-release"
|
||||||
} & {
|
} & {
|
||||||
@ -23,14 +24,14 @@ dagger.#Plan & {
|
|||||||
contents: "3.15.0\n"
|
contents: "3.15.0\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
copy: dagger.#Copy & {
|
copy: core.#Copy & {
|
||||||
input: busybox1_34_1.output
|
input: busybox1_34_1.output
|
||||||
contents: alpine3_15_0.output
|
contents: alpine3_15_0.output
|
||||||
source: "/etc/alpine-release"
|
source: "/etc/alpine-release"
|
||||||
dest: "/alpine3_15_0_release"
|
dest: "/alpine3_15_0_release"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_copy: dagger.#ReadFile & {
|
verify_copy: core.#ReadFile & {
|
||||||
input: copy.output
|
input: copy.output
|
||||||
path: "/alpine3_15_0_release"
|
path: "/alpine3_15_0_release"
|
||||||
} & {
|
} & {
|
||||||
|
@ -2,18 +2,19 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
alpineBase: dagger.#Pull & {
|
alpineBase: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
busyboxBase: dagger.#Pull & {
|
busyboxBase: core.#Pull & {
|
||||||
source: "busybox:1.34.1@sha256:1286c6d3c393023ef93c247724a6a2d665528144ffe07bacb741cc2b4edfefad"
|
source: "busybox:1.34.1@sha256:1286c6d3c393023ef93c247724a6a2d665528144ffe07bacb741cc2b4edfefad"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec1: dagger.#Exec & {
|
exec1: core.#Exec & {
|
||||||
input: alpineBase.output
|
input: alpineBase.output
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
@ -23,7 +24,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
exec2: dagger.#Exec & {
|
exec2: core.#Exec & {
|
||||||
input: exec1.output
|
input: exec1.output
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
@ -33,43 +34,43 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
removeme: dagger.#WriteFile & {
|
removeme: core.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: "/removeme"
|
path: "/removeme"
|
||||||
contents: "removeme"
|
contents: "removeme"
|
||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
diff: dagger.#Diff & {
|
diff: core.#Diff & {
|
||||||
lower: alpineBase.output
|
lower: alpineBase.output
|
||||||
upper: exec2.output
|
upper: exec2.output
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_diff_foo: dagger.#ReadFile & {
|
verify_diff_foo: core.#ReadFile & {
|
||||||
input: diff.output
|
input: diff.output
|
||||||
path: "/dir/foo"
|
path: "/dir/foo"
|
||||||
} & {
|
} & {
|
||||||
contents: "foo"
|
contents: "foo"
|
||||||
}
|
}
|
||||||
verify_diff_bar: dagger.#ReadFile & {
|
verify_diff_bar: core.#ReadFile & {
|
||||||
input: diff.output
|
input: diff.output
|
||||||
path: "/dir/bar"
|
path: "/dir/bar"
|
||||||
} & {
|
} & {
|
||||||
contents: "bar"
|
contents: "bar"
|
||||||
}
|
}
|
||||||
|
|
||||||
mergediff: dagger.#Merge & {
|
mergediff: core.#Merge & {
|
||||||
inputs: [
|
inputs: [
|
||||||
busyboxBase.output,
|
busyboxBase.output,
|
||||||
removeme.output,
|
removeme.output,
|
||||||
diff.output,
|
diff.output,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
verify_remove: dagger.#Exec & {
|
verify_remove: core.#Exec & {
|
||||||
input: mergediff.output
|
input: mergediff.output
|
||||||
args: ["test", "!", "-e", "/removeme"]
|
args: ["test", "!", "-e", "/removeme"]
|
||||||
}
|
}
|
||||||
verify_no_alpine_base: dagger.#Exec & {
|
verify_no_alpine_base: core.#Exec & {
|
||||||
input: mergediff.output
|
input: mergediff.output
|
||||||
// make sure the the Diff actually separated files from the base
|
// make sure the the Diff actually separated files from the base
|
||||||
// by testing the non-existence of a file that only exists in the
|
// by testing the non-existence of a file that only exists in the
|
||||||
|
@ -2,12 +2,13 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: testdata: read: contents: dagger.#FS
|
client: filesystem: testdata: read: contents: dagger.#FS
|
||||||
|
|
||||||
actions: build: dagger.#Dockerfile & {
|
actions: build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
dockerfile: contents: """
|
dockerfile: contents: """
|
||||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||||
|
@ -2,6 +2,7 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -15,12 +16,12 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
sopsSecrets: dagger.#DecodeSecret & {
|
sopsSecrets: core.#DecodeSecret & {
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
input: client.commands.sops.stdout
|
input: client.commands.sops.stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
auth: "daggerio/ci-test:private-pull": {
|
auth: "daggerio/ci-test:private-pull": {
|
||||||
username: "daggertest"
|
username: "daggertest"
|
||||||
|
@ -2,17 +2,18 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: testdata: read: contents: dagger.#FS
|
client: filesystem: testdata: read: contents: dagger.#FS
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: build.output
|
input: build.output
|
||||||
args: ["sh", "-c", "test $(cat /dir/foo) = foobar"]
|
args: ["sh", "-c", "test $(cat /dir/foo) = foobar"]
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,19 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: testdata: read: contents: dagger.#FS
|
client: filesystem: testdata: read: contents: dagger.#FS
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
dockerfile: path: "./dockerfilepath/Dockerfile.custom"
|
dockerfile: path: "./dockerfilepath/Dockerfile.custom"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: build.output
|
input: build.output
|
||||||
args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
|
args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -9,7 +10,7 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// FIXME: this doesn't test anything beside not crashing
|
// FIXME: this doesn't test anything beside not crashing
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
dockerfile: contents: """
|
dockerfile: contents: """
|
||||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||||
|
@ -2,13 +2,14 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: testdata: read: contents: dagger.#FS
|
client: filesystem: testdata: read: contents: dagger.#FS
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
dockerfile: contents: """
|
dockerfile: contents: """
|
||||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||||
@ -16,7 +17,7 @@ dagger.#Plan & {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: build.output
|
input: build.output
|
||||||
args: ["sh", "-c", "test $(cat /output) = foobar"]
|
args: ["sh", "-c", "test $(cat /output) = foobar"]
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,14 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: testdata: read: contents: dagger.#FS
|
client: filesystem: testdata: read: contents: dagger.#FS
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
dockerfile: contents: """
|
dockerfile: contents: """
|
||||||
# syntax = docker/dockerfile:1.3
|
# syntax = docker/dockerfile:1.3
|
||||||
@ -17,7 +18,7 @@ dagger.#Plan & {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: build.output
|
input: build.output
|
||||||
args: ["sh", "-c", "test $(cat /output) = foobar"]
|
args: ["sh", "-c", "test $(cat /output) = foobar"]
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -9,7 +10,7 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// FIXME: this doesn't test anything beside not crashing
|
// FIXME: this doesn't test anything beside not crashing
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
dockerfile: contents: """
|
dockerfile: contents: """
|
||||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||||
|
@ -2,6 +2,7 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -9,7 +10,7 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// FIXME: this doesn't test anything beside not crashing
|
// FIXME: this doesn't test anything beside not crashing
|
||||||
build: dagger.#Dockerfile & {
|
build: core.#Dockerfile & {
|
||||||
source: client.filesystem.testdata.read.contents
|
source: client.filesystem.testdata.read.contents
|
||||||
dockerfile: contents: """
|
dockerfile: contents: """
|
||||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||||
|
@ -2,20 +2,21 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: dagger.#Exec & {
|
exec: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["sh", "-c", "echo -n hello world > /output.txt"]
|
args: ["sh", "-c", "echo -n hello world > /output.txt"]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#ReadFile & {
|
verify: core.#ReadFile & {
|
||||||
input: exec.output
|
input: exec.output
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
} & {
|
} & {
|
||||||
|
@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
env: TEST: "hello world"
|
env: TEST: "hello world"
|
||||||
args: [
|
args: [
|
||||||
|
@ -2,17 +2,18 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: "secret.txt": read: contents: dagger.#Secret
|
client: filesystem: "secret.txt": read: contents: dagger.#Secret
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
env: TEST: client.filesystem."secret.txt".read.contents
|
env: TEST: client.filesystem."secret.txt".read.contents
|
||||||
args: [
|
args: [
|
||||||
|
@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
hosts: "unit.test": "1.2.3.4"
|
hosts: "unit.test": "1.2.3.4"
|
||||||
args: [
|
args: [
|
||||||
|
@ -2,19 +2,20 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedCache: dagger.#CacheDir & {
|
sharedCache: core.#CacheDir & {
|
||||||
id: "mycache"
|
id: "mycache"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: dagger.#Exec & {
|
exec: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: cache: {
|
mounts: cache: {
|
||||||
dest: "/cache"
|
dest: "/cache"
|
||||||
@ -29,7 +30,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: cache: {
|
mounts: cache: {
|
||||||
dest: "/cache"
|
dest: "/cache"
|
||||||
@ -44,10 +45,10 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
otherCache: dagger.#CacheDir & {
|
otherCache: core.#CacheDir & {
|
||||||
id: "othercache"
|
id: "othercache"
|
||||||
}
|
}
|
||||||
verifyOtherCache: dagger.#Exec & {
|
verifyOtherCache: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: cache: {
|
mounts: cache: {
|
||||||
dest: "/cache"
|
dest: "/cache"
|
||||||
|
@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: dagger.#Exec & {
|
exec: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
@ -21,7 +22,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: fs: {
|
mounts: fs: {
|
||||||
dest: "/target"
|
dest: "/target"
|
||||||
@ -36,7 +37,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyRO: dagger.#Exec & {
|
verifyRO: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: fs: {
|
mounts: fs: {
|
||||||
dest: "/target"
|
dest: "/target"
|
||||||
@ -54,7 +55,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verifySource: dagger.#Exec & {
|
verifySource: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: fs: {
|
mounts: fs: {
|
||||||
dest: "/target.txt"
|
dest: "/target.txt"
|
||||||
|
@ -2,17 +2,18 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: env: TESTSECRET: dagger.#Secret
|
client: env: TESTSECRET: dagger.#Secret
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: secret: {
|
mounts: secret: {
|
||||||
dest: "/run/secrets/test"
|
dest: "/run/secrets/test"
|
||||||
@ -27,7 +28,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyPerm: dagger.#Exec & {
|
verifyPerm: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: secret: {
|
mounts: secret: {
|
||||||
dest: "/run/secrets/test"
|
dest: "/run/secrets/test"
|
||||||
|
@ -2,22 +2,23 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
|
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
imageWithDocker: dagger.#Exec & {
|
imageWithDocker: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: imageWithDocker.output
|
input: imageWithDocker.output
|
||||||
mounts: docker: {
|
mounts: docker: {
|
||||||
dest: "/var/run/docker.sock"
|
dest: "/var/run/docker.sock"
|
||||||
|
@ -2,19 +2,20 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: dagger.#Exec & {
|
exec: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: temp: {
|
mounts: temp: {
|
||||||
dest: "/temp"
|
dest: "/temp"
|
||||||
contents: dagger.#TempDir
|
contents: core.#TempDir
|
||||||
}
|
}
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
@ -24,7 +25,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: exec.output
|
input: exec.output
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
|
@ -2,20 +2,21 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
addUser: dagger.#Exec & {
|
addUser: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["adduser", "-D", "test"]
|
args: ["adduser", "-D", "test"]
|
||||||
}
|
}
|
||||||
test: {
|
test: {
|
||||||
verifyUsername: dagger.#Exec & {
|
verifyUsername: core.#Exec & {
|
||||||
input: addUser.output
|
input: addUser.output
|
||||||
user: "test"
|
user: "test"
|
||||||
args: [
|
args: [
|
||||||
@ -26,7 +27,7 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyUserID: dagger.#Exec & {
|
verifyUserID: core.#Exec & {
|
||||||
input: addUser.output
|
input: addUser.output
|
||||||
user: "1000"
|
user: "1000"
|
||||||
args: [
|
args: [
|
||||||
|
@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
workdir: "/tmp"
|
workdir: "/tmp"
|
||||||
args: [
|
args: [
|
||||||
|
@ -2,21 +2,22 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: test: {
|
actions: test: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15"
|
source: "alpine:3.15"
|
||||||
}
|
}
|
||||||
|
|
||||||
export: dagger.#Export & {
|
export: core.#Export & {
|
||||||
input: image.output
|
input: image.output
|
||||||
config: image.config
|
config: image.config
|
||||||
tag: "example"
|
tag: "example"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
mounts: exported: {
|
mounts: exported: {
|
||||||
contents: export.output
|
contents: export.output
|
||||||
|
@ -2,10 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: badref: dagger.#GitPull & {
|
actions: badref: core.#GitPull & {
|
||||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||||
ref: "lalalalal"
|
ref: "lalalalal"
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: badremote: dagger.#GitPull & {
|
actions: badremote: core.#GitPull & {
|
||||||
remote: "https://github.com/blocklayerhq/lalalala.git"
|
remote: "https://github.com/blocklayerhq/lalalala.git"
|
||||||
ref: "master"
|
ref: "master"
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: gitPull: dagger.#GitPull & {
|
actions: gitPull: core.#GitPull & {
|
||||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||||
ref: "master"
|
ref: "master"
|
||||||
}
|
}
|
||||||
|
@ -2,26 +2,27 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
repo1: dagger.#GitPull & {
|
repo1: core.#GitPull & {
|
||||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||||
ref: "master"
|
ref: "master"
|
||||||
}
|
}
|
||||||
|
|
||||||
repo2: dagger.#GitPull & {
|
repo2: core.#GitPull & {
|
||||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||||
ref: "master"
|
ref: "master"
|
||||||
keepGitDir: true
|
keepGitDir: true
|
||||||
}
|
}
|
||||||
|
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0"
|
source: "alpine:3.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: dagger.#Exec & {
|
verify: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: ["sh", "-c", """
|
args: ["sh", "-c", """
|
||||||
set -eu
|
set -eu
|
||||||
|
@ -2,8 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: invalid: dagger.#GitPull & {}
|
actions: invalid: core.#GitPull & {}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
@ -13,16 +14,16 @@ dagger.#Plan & {
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
alpine: dagger.#Pull & {
|
alpine: core.#Pull & {
|
||||||
source: "alpine:3.15.0"
|
source: "alpine:3.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
sopsSecrets: dagger.#DecodeSecret & {
|
sopsSecrets: core.#DecodeSecret & {
|
||||||
format: "yaml"
|
format: "yaml"
|
||||||
input: client.commands.sops.stdout
|
input: client.commands.sops.stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
testRepo: dagger.#GitPull & {
|
testRepo: core.#GitPull & {
|
||||||
remote: "https://github.com/dagger/dagger.git"
|
remote: "https://github.com/dagger/dagger.git"
|
||||||
ref: "main"
|
ref: "main"
|
||||||
auth: {
|
auth: {
|
||||||
@ -31,7 +32,7 @@ dagger.#Plan & {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
testContent: dagger.#Exec & {
|
testContent: core.#Exec & {
|
||||||
input: alpine.output
|
input: alpine.output
|
||||||
always: true
|
always: true
|
||||||
args: ["ls", "-l", "/repo/README.md"]
|
args: ["ls", "-l", "/repo/README.md"]
|
||||||
|
@ -2,21 +2,22 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
"testing.dagger.io/hidden"
|
"testing.dagger.io/hidden"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
pull: dagger.#Pull & {
|
pull: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
_write: dagger.#WriteFile & {
|
_write: core.#WriteFile & {
|
||||||
input: pull.output
|
input: pull.output
|
||||||
path: "/testing"
|
path: "/testing"
|
||||||
contents: "1,2,3"
|
contents: "1,2,3"
|
||||||
permissions: 700
|
permissions: 700
|
||||||
}
|
}
|
||||||
readfile: dagger.#ReadFile & {
|
readfile: core.#ReadFile & {
|
||||||
input: _write.output
|
input: _write.output
|
||||||
path: "/testing"
|
path: "/testing"
|
||||||
} & {
|
} & {
|
||||||
|
@ -2,10 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: fetch: dagger.#HTTPFetch & {
|
actions: fetch: core.#HTTPFetch & {
|
||||||
source: "https://releases.dagger.io/dagger/latest_version"
|
source: "https://releases.dagger.io/dagger/latest_version"
|
||||||
dest: "/latest.html"
|
dest: "/latest.html"
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: fetch: dagger.#HTTPFetch & {
|
actions: fetch: core.#HTTPFetch & {
|
||||||
source: "https://releases.dagger.io/dagger/asfgdsfg"
|
source: "https://releases.dagger.io/dagger/asfgdsfg"
|
||||||
dest: "/latest.html"
|
dest: "/latest.html"
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/dagger/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: {
|
actions: {
|
||||||
image: dagger.#Pull & {
|
image: core.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: dagger.#Exec & {
|
exec: core.#Exec & {
|
||||||
input: image.output
|
input: image.output
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
@ -20,31 +21,31 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
dir: dagger.#Mkdir & {
|
dir: core.#Mkdir & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: "/dir"
|
path: "/dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
dirfoo: dagger.#WriteFile & {
|
dirfoo: core.#WriteFile & {
|
||||||
input: dir.output
|
input: dir.output
|
||||||
path: "/dir/foo"
|
path: "/dir/foo"
|
||||||
contents: "foo"
|
contents: "foo"
|
||||||
}
|
}
|
||||||
|
|
||||||
dirfoo2: dagger.#WriteFile & {
|
dirfoo2: core.#WriteFile & {
|
||||||
input: dir.output
|
input: dir.output
|
||||||
path: "/dir/foo"
|
path: "/dir/foo"
|
||||||
contents: "foo2"
|
contents: "foo2"
|
||||||
}
|
}
|
||||||
|
|
||||||
dirbar: dagger.#WriteFile & {
|
dirbar: core.#WriteFile & {
|
||||||
input: dir.output
|
input: dir.output
|
||||||
path: "/dir/bar"
|
path: "/dir/bar"
|
||||||
contents: "bar"
|
contents: "bar"
|
||||||
}
|
}
|
||||||
|
|
||||||
test: {
|
test: {
|
||||||
merge: dagger.#Merge & {
|
merge: core.#Merge & {
|
||||||
inputs: [
|
inputs: [
|
||||||
dir.output,
|
dir.output,
|
||||||
dirfoo.output,
|
dirfoo.output,
|
||||||
@ -54,19 +55,19 @@ dagger.#Plan & {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_merge_output: dagger.#ReadFile & {
|
verify_merge_output: core.#ReadFile & {
|
||||||
input: merge.output
|
input: merge.output
|
||||||
path: "/output.txt"
|
path: "/output.txt"
|
||||||
} & {
|
} & {
|
||||||
contents: "hello world"
|
contents: "hello world"
|
||||||
}
|
}
|
||||||
verify_merge_dirbar: dagger.#ReadFile & {
|
verify_merge_dirbar: core.#ReadFile & {
|
||||||
input: merge.output
|
input: merge.output
|
||||||
path: "/dir/bar"
|
path: "/dir/bar"
|
||||||
} & {
|
} & {
|
||||||
contents: "bar"
|
contents: "bar"
|
||||||
}
|
}
|
||||||
verify_merge_dirfoo: dagger.#ReadFile & {
|
verify_merge_dirfoo: core.#ReadFile & {
|
||||||
input: merge.output
|
input: merge.output
|
||||||
path: "/dir/foo"
|
path: "/dir/foo"
|
||||||
} & {
|
} & {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user