Merge pull request #1866 from helderco/dagger-core

Move core actions to `dagger/core` sub-package
This commit is contained in:
Helder Correia 2022-03-28 17:51:44 +00:00 committed by GitHub
commit 4058d56f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
122 changed files with 668 additions and 538 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/bash"
)
@ -19,7 +20,7 @@ dagger.#Plan & {
_mountGoCache: {
mounts: "go mod cache": {
dest: "/root/.gocache"
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
id: "go mod cache"
}
}

View File

@ -2,12 +2,13 @@ package main
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
)
dagger.#Plan & {
client: filesystem: "./src": read: contents: dagger.#FS
actions: build: dagger.#Dockerfile & {
actions: build: docker.#Dockerfile & {
// This is the context.
source: client.filesystem."./src".read.contents

View File

@ -23,7 +23,7 @@ dagger.#Plan & {
run: bash.#Run & {
// ...
}
contents: dagger.#Subdir & {
contents: core.#Subdir & {
// ...
}
}

View File

@ -5,7 +5,7 @@ dagger.#Plan & {
contents: dagger.#Secret
}
actions: {
registry: dagger.#TrimSecret & {
registry: core.#TrimSecret & {
input: client.filesystem.".registry".read.contents
}
pull: docker.#Pull & {

View File

@ -7,7 +7,7 @@ dagger.#Plan & {
actions: {
// Makes the yaml keys easily accessible
secrets: dagger.#DecodeSecret & {
secrets: core.#DecodeSecret & {
input: client.commands.sops.stdout
format: "yaml"
}

View File

@ -28,6 +28,7 @@ package particubes
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -63,7 +64,7 @@ dagger.#Plan & {
image: build.output
}
docsSecrets: dagger.#DecodeSecret & {
docsSecrets: core.#DecodeSecret & {
input: inputs.secrets.docs.contents
format: "yaml"
}

View File

@ -1,11 +1,13 @@
package dagger
package core
import "dagger.io/dagger"
// Execute a command in a container
#Exec: {
$dagger: task: _name: "Exec"
// Container filesystem
input: #FS
input: dagger.#FS
// Transient filesystem mounts
// Key is an arbitrary name, for example "app source code"
@ -17,7 +19,7 @@ package dagger
args: [...string]
// Environment variables
env: [key=string]: string | #Secret
env: [key=string]: string | dagger.#Secret
// Working directory
workdir: string | *"/"
@ -33,7 +35,7 @@ package dagger
hosts: [hostname=string]: string
// Modified filesystem
output: #FS
output: dagger.#FS
// Command exit code
// Currently this field can only ever be zero.
@ -54,15 +56,15 @@ package dagger
contents: #TempDir
} | {
type: "service"
contents: #Service
contents: dagger.#Service
} | {
type: "fs"
contents: #FS
contents: dagger.#FS
source?: string
ro?: true | *false
} | {
type: "secret"
contents: #Secret
contents: dagger.#Secret
uid: int | *0
gid: int | *0
mask: int | *0o400

View File

@ -1,4 +1,6 @@
package dagger
package core
import "dagger.io/dagger"
// Access the source directory for the current CUE package
// This may safely be called from any package
@ -12,7 +14,7 @@ package dagger
// Optionally include certain files
exclude: [...string]
output: #FS
output: dagger.#FS
}
// Create one or multiple directory in a container
@ -20,7 +22,7 @@ package dagger
$dagger: task: _name: "Mkdir"
// Container filesystem
input: #FS
input: dagger.#FS
// Path of the directory to create
// It can be nested (e.g : "/foo" or "/foo/bar")
@ -33,14 +35,14 @@ package dagger
parents: *true | false
// Modified filesystem
output: #FS
output: dagger.#FS
}
#ReadFile: {
$dagger: task: _name: "ReadFile"
// Filesystem tree holding the file
input: #FS
input: dagger.#FS
// Path of the file to read
path: string
// Contents of the file
@ -52,7 +54,7 @@ package dagger
$dagger: task: _name: "WriteFile"
// Input filesystem tree
input: #FS
input: dagger.#FS
// Path of the file to write
path: string
// Contents to write
@ -60,27 +62,27 @@ package dagger
// Permissions of the file
permissions: *0o600 | int
// Output filesystem tree
output: #FS
output: dagger.#FS
}
// Copy files from one FS tree to another
#Copy: {
$dagger: task: _name: "Copy"
// Input of the operation
input: #FS
input: dagger.#FS
// Contents to copy
contents: #FS
contents: dagger.#FS
// Source path (optional)
source: string | *"/"
// Destination path (optional)
dest: string | *"/"
// Output of the operation
output: #FS
output: dagger.#FS
}
#CopyInfo: {
source: {
root: #FS
root: dagger.#FS
path: string | *"/"
}
dest: string
@ -89,22 +91,22 @@ package dagger
// Merge multiple FS trees into one
#Merge: {
$dagger: task: _name: "Merge"
inputs: [...#FS]
output: #FS
inputs: [...dagger.#FS]
output: dagger.#FS
}
// Extract the difference from lower FS to upper FS as its own FS
#Diff: {
$dagger: task: _name: "Diff"
lower: #FS
upper: #FS
output: #FS
lower: dagger.#FS
upper: dagger.#FS
output: dagger.#FS
}
// Select a subdirectory from a filesystem tree
#Subdir: {
// Input tree
input: #FS
input: dagger.#FS
// Path of the subdirectory
// Example: "/build"
@ -112,12 +114,12 @@ package dagger
// Copy action
_copy: #Copy & {
"input": #Scratch
"input": dagger.#Scratch
contents: input
source: path
dest: "/"
}
// Subdirectory tree
output: #FS & _copy.output
output: dagger.#FS & _copy.output
}

View File

@ -1,11 +1,13 @@
package dagger
package core
import "dagger.io/dagger"
// Push a directory to a git remote
#GitPush: {
@dagger(notimplemented)
$dagger: task: _name: "GitPush"
input: #FS
input: dagger.#FS
remote: string
ref: string
}
@ -20,11 +22,11 @@ package dagger
keepGitDir: true | *false
auth?: {
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
}

View File

@ -1,4 +1,4 @@
package dagger
package core
// HTTP operations
@ -16,6 +16,8 @@ package dagger
// func Chown(uid, gid int) HTTPOption
// func Filename(name string) HTTPOption
import "dagger.io/dagger"
// Fetch a file over HTTP
#HTTPFetch: {
$dagger: task: _name: "HTTPFetch"
@ -43,5 +45,5 @@ package dagger
gid?: int
// New filesystem state containing the downloaded file
output: #FS
output: dagger.#FS
}

View 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
}
}
}

View File

@ -1,4 +1,4 @@
package dagger
package core
// A core action that does nothing
// Useful to work around bugs in the DAG resolver.

View File

@ -1,17 +1,19 @@
package dagger
package core
import "dagger.io/dagger"
// Decode the contents of a secrets without leaking it.
// Supported formats: json, yaml
#DecodeSecret: {
$dagger: task: _name: "DecodeSecret"
// A #Secret whose plain text is a JSON or YAML string
input: #Secret
// A dagger.#Secret whose plain text is a JSON or YAML string
input: dagger.#Secret
format: "json" | "yaml"
// 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
@ -19,13 +21,13 @@ package dagger
$dagger: task: _name: "NewSecret"
// Filesystem tree holding the secret
input: #FS
input: dagger.#FS
// Path of the secret to read
path: string
// Whether to trim leading and trailing space characters from secret value
trimSpace: *true | false
// Contents of the secret
output: #Secret
output: dagger.#Secret
}
// Trim leading and trailing space characters from a secret
@ -33,8 +35,8 @@ package dagger
$dagger: task: _name: "TrimSecret"
// Original secret
input: #Secret
input: dagger.#Secret
// New trimmed secret
output: #Secret
output: dagger.#Secret
}

View File

@ -1,32 +1,5 @@
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
//
// Examples:
@ -61,156 +34,3 @@ import (
startperiod?: 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
}
}
}

View File

@ -32,6 +32,7 @@ var (
}
DaggerPackage = fmt.Sprintf("%s/dagger", DaggerModule)
DaggerCorePackage = fmt.Sprintf("%s/core", DaggerPackage)
lockFilePath = "dagger.lock"
)

View File

@ -2,6 +2,7 @@ package alpine
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/alpine"
"universe.dagger.io/docker"
@ -16,7 +17,7 @@ dagger.#Plan & {
version: "3.10.9"
}
verify: dagger.#Readfile & {
verify: core.#ReadFile & {
input: build.output.rootfs
path: "/etc/alpine-release"
contents: "3.10.9\n"

View File

@ -3,6 +3,7 @@ package aws
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -39,7 +40,7 @@ import (
]
}
_scripts: dagger.#Source & {
_scripts: core.#Source & {
path: "_scripts"
}

View File

@ -2,6 +2,7 @@ package test
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/aws"
"universe.dagger.io/aws/cli"
)
@ -14,7 +15,7 @@ dagger.#Plan & {
}
actions: {
sopsSecrets: dagger.#DecodeSecret & {
sopsSecrets: core.#DecodeSecret & {
format: "yaml"
input: client.commands.sops.stdout
}

View File

@ -3,6 +3,7 @@ package test
import (
"encoding/json"
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/aws"
)
@ -20,7 +21,7 @@ dagger.#Plan & {
}
actions: {
sopsSecrets: dagger.#DecodeSecret & {
sopsSecrets: core.#DecodeSecret & {
format: "yaml"
input: client.commands.sops.stdout
}

View File

@ -3,6 +3,7 @@ package test
import (
"encoding/json"
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/aws"
)
@ -14,7 +15,7 @@ dagger.#Plan & {
}
actions: {
sopsSecrets: dagger.#DecodeSecret & {
sopsSecrets: core.#DecodeSecret & {
format: "yaml"
input: client.commands.sops.stdout
}

View File

@ -3,6 +3,7 @@ package bash
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -26,7 +27,7 @@ import (
contents: string
_filename: "run.sh"
_write: dagger.#WriteFile & {
_write: core.#WriteFile & {
input: dagger.#Scratch
path: _filename
"contents": contents

View File

@ -2,6 +2,7 @@ package bash
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
"universe.dagger.io/bash"
@ -19,7 +20,7 @@ dagger.#Plan & {
runFile: {
dir: _load.output
_load: dagger.#Source & {
_load: core.#Source & {
path: "./data"
include: ["*.sh"]
}

View File

@ -2,6 +2,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
// Modular build API for Docker containers
@ -46,7 +47,7 @@ import (
dest: string | *"/"
// Execute copy operation
_copy: dagger.#Copy & {
_copy: core.#Copy & {
"input": input.rootfs
"contents": contents
"source": source
@ -83,7 +84,7 @@ import (
label: [string]: string
hosts: [string]: string
_build: dagger.#Dockerfile & {
_build: core.#Dockerfile & {
"source": source
"auth": auth
"dockerfile": dockerfile

View File

@ -1,7 +1,7 @@
package cli
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -19,7 +19,7 @@ import (
// Root filesystem with exported file
result: _export.output
_export: dagger.#Export & {
_export: core.#Export & {
"tag": tag
input: image.rootfs
config: image.config

View File

@ -3,6 +3,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
// Download an image from a remote registry
@ -16,7 +17,7 @@ import (
secret: dagger.#Secret
}
_op: dagger.#Pull & {
_op: core.#Pull & {
"source": source
if auth != _|_ {
"auth": auth

View File

@ -2,6 +2,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
// Upload an image to a remote repository
@ -21,7 +22,7 @@ import (
// Image to push
image: #Image
_push: dagger.#Push & {
_push: core.#Push & {
"dest": dest
if auth != _|_ {
"auth": auth

View File

@ -4,6 +4,7 @@ import (
"list"
"dagger.io/dagger"
"dagger.io/dagger/core"
)
// Run a command in a container
@ -14,7 +15,7 @@ import (
always: bool | *false
// Filesystem mounts
mounts: [name=string]: dagger.#Mount
mounts: [name=string]: core.#Mount
// Expose network ports
// FIXME: investigate feasibility
@ -70,7 +71,7 @@ import (
// Add defaults to image config
// This ensures these values are present
_defaults: dagger.#Set & {
_defaults: core.#Set & {
"input": {
entrypoint: []
cmd: []
@ -81,7 +82,7 @@ import (
}
// Override with user config
_config: dagger.#Set & {
_config: core.#Set & {
input: _defaults.output
config: {
if entrypoint != _|_ {
@ -123,7 +124,7 @@ import (
for path, _ in files {
"\(path)": {
contents: string & _read.contents
_read: dagger.#ReadFile & {
_read: core.#ReadFile & {
input: _exec.output
"path": path
}
@ -139,7 +140,7 @@ import (
for path, _ in directories {
"\(path)": {
contents: dagger.#FS & _subdir.output
_subdir: dagger.#Subdir & {
_subdir: core.#Subdir & {
input: _exec.output
"path": path
}
@ -159,7 +160,7 @@ import (
}
// Actually execute the command
_exec: dagger.#Exec & {
_exec: core.#Exec & {
"input": input.rootfs
"always": always
"mounts": mounts
@ -167,7 +168,7 @@ import (
workdir: _config.output.workdir
user: _config.output.user
"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 != _|_ {
for key, val in input.config.env {
if env[key] == _|_ {

View File

@ -2,6 +2,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
// Change image config
@ -12,7 +13,7 @@ import (
// The image config to change
config: dagger.#ImageConfig
_set: dagger.#Set & {
_set: core.#Set & {
"input": input.config
"config": config
}

View File

@ -2,6 +2,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/alpine"
"universe.dagger.io/docker"
@ -26,7 +27,7 @@ dagger.#Plan & {
]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: image.output.rootfs
path: "/test.txt"
}
@ -59,7 +60,7 @@ dagger.#Plan & {
]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: image.output.rootfs
path: "/test.txt"
}

View File

@ -2,6 +2,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -33,7 +34,7 @@ dagger.#Plan & {
]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: build.output.rootfs
path: "/test.txt"
} & {
@ -58,7 +59,7 @@ dagger.#Plan & {
]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: build.output.rootfs
path: "/test.txt"
} & {

View File

@ -2,6 +2,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -43,7 +44,7 @@ dagger.#Plan & {
// Test: image config behavior is correct
config: {
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: dagger.#Scratch
dockerfile: contents: """
FROM alpine:3.15.0

View File

@ -2,6 +2,7 @@ package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
"universe.dagger.io/alpine"
@ -24,7 +25,7 @@ dagger.#Plan & {
}
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: run.output.rootfs
path: "/output.txt"
}
@ -59,7 +60,7 @@ dagger.#Plan & {
export: directories: "/test": _
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: run.export.directories."/test"
path: "/output.txt"
}

View File

@ -56,11 +56,11 @@ dagger.#Plan & {
}
actions: {
runtimeImage: dagger.#Pull & {
runtimeImage: core.#Pull & {
source: runtime_image_ref
}
depsCache: dagger.#CacheDir & {
depsCache: core.#CacheDir & {
id: "depsCache"
}
@ -69,7 +69,7 @@ dagger.#Plan & {
contents: depsCache
}
buildCacheTest: dagger.#CacheDir & {
buildCacheTest: core.#CacheDir & {
id: "buildCacheTest"
}
@ -78,7 +78,7 @@ dagger.#Plan & {
contents: buildCacheTest
}
buildCacheProd: dagger.#CacheDir & {
buildCacheProd: core.#CacheDir & {
id: "buildCacheProd"
}
@ -87,7 +87,7 @@ dagger.#Plan & {
contents: buildCacheProd
}
nodeModulesCache: dagger.#CacheDir & {
nodeModulesCache: core.#CacheDir & {
id: "nodeModulesCache"
}
@ -96,20 +96,20 @@ dagger.#Plan & {
contents: nodeModulesCache
}
appImage: dagger.#Copy & {
appImage: core.#Copy & {
input: runtimeImage.output
contents: inputs.directories.app.contents
dest: "/app"
}
deps: dagger.#Exec & {
deps: core.#Exec & {
input: appImage.output
mounts: depsCacheMount
workdir: "/app"
args: ["bash", "-c", " mix deps.get"]
}
assetsCompile: dagger.#Exec & {
assetsCompile: core.#Exec & {
input: depsCompileProd.output
mounts: depsCacheMount & nodeModulesCacheMount
workdir: "/app/assets"
@ -117,7 +117,7 @@ dagger.#Plan & {
args: ["bash", "-c", "yarn install --frozen-lockfile && yarn run compile"]
}
#depsCompile: dagger.#Exec & {
#depsCompile: core.#Exec & {
input: deps.output
mounts: depsCacheMount
workdir: "/app"
@ -134,7 +134,7 @@ dagger.#Plan & {
mounts: buildCacheProdMount
}
assetsDigest: dagger.#Exec & {
assetsDigest: core.#Exec & {
input: assetsCompile.output
mounts: depsCacheMount & buildCacheProdMount & nodeModulesCacheMount
env: MIX_ENV: "prod"
@ -142,20 +142,20 @@ dagger.#Plan & {
args: ["bash", "-c", "mix phx.digest"]
}
imageProdCacheCopy: dagger.#Exec & {
imageProdCacheCopy: core.#Exec & {
input: assetsDigest.output
mounts: (depsCacheMount & {depsCache: dest: "/mnt/app/deps/"} )
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/"]
}
imageProdDockerCopy: dagger.#Copy & {
imageProdDockerCopy: core.#Copy & {
input: imageProdCacheCopy.output
source: root: inputs.directories.docker.contents
dest: "/"
}
imageProd: dagger.#Build & {
imageProd: core.#Dockerfile & {
source: imageProdDockerCopy.output
dockerfile: path: "/docker/Dockerfile.production"
buildArg: {

View File

@ -19,7 +19,7 @@ actions: {
// workdir: _
// // FIXME: remove copy-pasta
// mounts: nodeModules: {
// contents: dagger.#CacheDir & {
// contents: core.#CacheDir & {
// // FIXME: do we need an ID here?
// id: "\(mix.app)_assets_node_modules"
// // 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?)
// mounts: nodeModules: {
// contents: dagger.#CacheDir & {
// contents: core.#CacheDir & {
// // FIXME: do we need an ID here?
// id: "\(mix.app)_assets_node_modules"
// // FIXME: will there be multiple writers?

View File

@ -67,7 +67,7 @@ import (
}
if cache.deps != null {
mounts: deps: {
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
id: "\(app.name)_deps"
concurrency: cache.deps
}
@ -76,7 +76,7 @@ import (
}
if cache.build != null {
mounts: buildCache: {
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
id: "\(app.name)_build_\(env)"
concurrency: cache.build
}

View File

@ -2,6 +2,7 @@ package todoapp
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/alpine"
"universe.dagger.io/bash"
"universe.dagger.io/docker"
@ -9,10 +10,10 @@ import (
)
dagger.#Plan & {
_nodeModulesMount: "/src/node_modules": dagger.#Mount & {
_nodeModulesMount: "/src/node_modules": {
dest: "/src/node_modules"
type: "cache"
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
id: "todoapp-modules-cache"
}
@ -53,10 +54,10 @@ dagger.#Plan & {
bash.#Run & {
workdir: "/src"
mounts: {
"/cache/yarn": dagger.#Mount & {
"/cache/yarn": {
dest: "/cache/yarn"
type: "cache"
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
id: "todoapp-yarn-cache"
}
}
@ -89,7 +90,7 @@ dagger.#Plan & {
"""#
}
contents: dagger.#Subdir & {
contents: core.#Subdir & {
input: run.output.rootfs
path: "/src/build"
}

View File

@ -1,7 +1,8 @@
package git
import (
"dagger.io/dagger/core"
)
#Pull: dagger.#GitPull
#Push: dagger.#GitPush
#Pull: core.#GitPull
#Push: core.#GitPush

View File

@ -3,6 +3,7 @@ package go
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -30,7 +31,7 @@ import (
contents: source
}
"go assets cache": {
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
id: "\(name)_assets"
}
dest: _cachePath

View File

@ -2,6 +2,7 @@ package go
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/go"
"universe.dagger.io/docker"
"universe.dagger.io/alpine"
@ -32,7 +33,7 @@ dagger.#Plan & {
}
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: exec.output.rootfs
path: "/output.txt"
} & {

View File

@ -4,6 +4,7 @@ package netlify
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/alpine"
"universe.dagger.io/docker"
@ -60,7 +61,7 @@ import (
container: bash.#Run & {
input: *_build.output | docker.#Image
script: {
_load: dagger.#Source & {
_load: core.#Source & {
path: "."
include: ["*.sh"]
}

View File

@ -2,6 +2,7 @@ package netlify
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
"universe.dagger.io/netlify"
@ -20,7 +21,7 @@ dagger.#Plan & {
// Configuration common to all tests
common: {
testSecrets: dagger.#DecodeSecret & {
testSecrets: core.#DecodeSecret & {
input: client.commands.sops.stdout
format: "yaml"
}
@ -29,7 +30,7 @@ dagger.#Plan & {
marker: "hello world"
data: dagger.#WriteFile & {
data: core.#WriteFile & {
input: dagger.#Scratch
path: "index.html"
contents: marker

View File

@ -3,6 +3,7 @@ package powershell
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
@ -26,7 +27,7 @@ import (
contents: string
_filename: "run.ps1"
_write: dagger.#WriteFile & {
_write: core.#WriteFile & {
input: dagger.#Scratch
path: _filename
"contents": contents

View File

@ -2,6 +2,7 @@ package powershell
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
"universe.dagger.io/powershell"
@ -19,7 +20,7 @@ dagger.#Plan & {
runFile: {
dir: _load.output
_load: dagger.#Source & {
_load: core.#Source & {
path: "./data"
include: ["*.ps1"]
}

View File

@ -2,6 +2,7 @@ package yarn
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
"universe.dagger.io/yarn"
@ -78,7 +79,7 @@ dagger.#Plan & {
path: string
contents: string
_read: dagger.#ReadFile & {
_read: core.#ReadFile & {
"input": input
"path": path
}

View File

@ -5,6 +5,7 @@ import (
"strings"
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/alpine"
"universe.dagger.io/bash"
@ -78,7 +79,7 @@ import (
mounts: "yarn cache": {
dest: "/cache/yarn"
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
// FIXME: are there character limitations in cache ID?
id: "universe.dagger.io/yarn.#Run \(name)"
}
@ -109,7 +110,7 @@ import (
mounts: "yarn cache": {
dest: "/cache/yarn"
contents: dagger.#CacheDir & {
contents: core.#CacheDir & {
// FIXME: are there character limitations in cache ID?
id: "universe.dagger.io/yarn.#Run \(name)"
}
@ -135,7 +136,7 @@ import (
}
// The final contents of the package after run
_output: dagger.#Subdir & {
_output: core.#Subdir & {
input: _run.output.rootfs
path: "/build"
}

View File

@ -20,6 +20,11 @@ var (
cue.Str("$dagger"),
cue.Str("task"),
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.
@ -64,12 +69,7 @@ func Lookup(v *compiler.Value) (Task, error) {
return nil, ErrNotTask
}
typ := v.LookupPath(typePath)
if !typ.Exists() {
return nil, ErrNotTask
}
typeString, err := typ.String()
typeString, err := lookupType(v)
if err != nil {
return nil, err
}
@ -81,3 +81,13 @@ func Lookup(v *compiler.Value) (Task, error) {
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
}

View File

@ -1,10 +1,10 @@
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
_source: dagger.#Source & {
_source: core.#Source & {
path: "."
exclude: [
"ci",

View File

@ -36,6 +36,7 @@ setup() {
assert_output --partial 'client.filesystem."./test_do".write'
refute_output --partial "actions.notMe"
refute_output --partial 'client.filesystem."./dependent_do".write'
rm -f ./test_do
}
@test "plan/do: nice error message for 0.1.0 projects" {

View File

@ -3,6 +3,7 @@ package main
import (
"strings"
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -28,28 +29,28 @@ dagger.#Plan & {
invalid: name: "foobar"
}
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: {
invalid: dagger.#Exec & {
invalid: core.#Exec & {
input: image.output
args: ["echo", client.commands.invalid.stdout]
}
valid: {
normal: dagger.#Exec & {
normal: core.#Exec & {
input: image.output
args: ["test", strings.TrimSpace(client.commands.normal.stdout), "=", "hello europa"]
}
relative: dagger.#Exec & {
relative: core.#Exec & {
input: image.output
args: ["test", strings.TrimSpace(client.commands.relative.stdout), "=", "test"]
}
error: dagger.#Exec & {
error: core.#Exec & {
input: image.output
args: ["test", strings.TrimSpace(client.commands.error.stderr), "=", "error"]
}
secret: dagger.#Exec & {
secret: core.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"

View File

@ -2,16 +2,17 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: env: TEST_FAIL: "env"
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: dagger.#Exec & {
test: core.#Exec & {
input: image.output
args: [client.env.TEST_FAIL]
}

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -10,15 +11,15 @@ dagger.#Plan & {
TEST_SECRET: dagger.#Secret
}
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: {
string: dagger.#Exec & {
string: core.#Exec & {
input: image.output
args: ["test", client.env.TEST_STRING, "=", "foo"]
}
secret: dagger.#Exec & {
secret: core.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -11,15 +12,15 @@ dagger.#Plan & {
write: contents: actions.test.export.contents
}
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: {
read: dagger.#Exec & {
read: core.#Exec & {
input: image.output
args: ["echo", client.filesystem."test.txt".read.contents]
}
write: dagger.#Exec & {
write: core.#Exec & {
input: image.output
args: ["sh", "-c",
#"""
@ -27,7 +28,7 @@ dagger.#Plan & {
"""#,
]
}
export: dagger.#ReadFile & {
export: core.#ReadFile & {
input: write.output
path: "out.txt"
}

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -11,20 +12,20 @@ dagger.#Plan & {
"secret.txt": read: contents: dagger.#Secret
}
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: {
concrete: dagger.#Exec & {
concrete: core.#Exec & {
input: image.output
args: ["sh", "-c", client.filesystem."cmd.sh".read.contents]
}
usage: {
string: dagger.#Exec & {
string: core.#Exec & {
input: image.output
args: ["test", client.filesystem."test.txt".read.contents, "=", "foo"]
}
secret: dagger.#Exec & {
secret: core.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -10,7 +11,7 @@ dagger.#Plan & {
include: ["*.txt"]
}
actions: test: {
[string]: dagger.#ReadFile & {
[string]: core.#ReadFile & {
input: client.filesystem."../rootfs".read.contents
}
valid: {

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -10,7 +11,7 @@ dagger.#Plan & {
exclude: ["*.log"]
}
actions: test: {
[string]: dagger.#ReadFile & {
[string]: core.#ReadFile & {
input: client.filesystem.rootfs.read.contents
}
valid: {

View File

@ -2,22 +2,23 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: "/var/run/docker.soc": read: contents: dagger.#Service
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
imageWithDocker: dagger.#Exec & {
imageWithDocker: core.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
test: dagger.#Exec & {
test: core.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"

View File

@ -2,22 +2,23 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
imageWithDocker: dagger.#Exec & {
imageWithDocker: core.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
test: dagger.#Exec & {
test: core.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"

View File

@ -2,22 +2,23 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: "//./pipe/docker_engine": read: contents: dagger.#Service
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
imageWithDocker: dagger.#Exec & {
imageWithDocker: core.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
test: dagger.#Exec & {
test: core.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -15,30 +16,30 @@ dagger.#Plan & {
}
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: {
fs: data: dagger.#WriteFile & {
fs: data: core.#WriteFile & {
input: dagger.#Scratch
path: "/test"
contents: "foobar"
}
file: {
// Only using contents for reference in client
data: dagger.#WriteFile & {
data: core.#WriteFile & {
input: dagger.#Scratch
path: "/test"
contents: "foobaz"
}
}
secret: {
create: dagger.#WriteFile & {
create: core.#WriteFile & {
input: dagger.#Scratch
path: "/test"
contents: "foo-barab-oof"
}
data: dagger.#NewSecret & {
data: core.#NewSecret & {
input: create.output
path: "/test"
}

View File

@ -2,21 +2,21 @@ package main
import (
"dagger.io/dagger"
// "alpha.dagger.io/os"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: test: {
_image: dagger.#Pull & {
_image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
_exec: dagger.#Exec & {
_exec: core.#Exec & {
input: _image.output
args: ["sh", "-c", "echo -n Hello Europa > /out.txt"]
}
_verify: dagger.#ReadFile & {
_verify: core.#ReadFile & {
input: _exec.output
path: "/out.txt"
} & {

View File

@ -1,17 +1,19 @@
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
platform: "linux/unknown"
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0"
}
writeArch: dagger.#Exec & {
writeArch: core.#Exec & {
input: image.output
always: true
args: [
@ -21,7 +23,7 @@ dagger.#Plan & {
]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: writeArch.output
path: "/arch.txt"
} & {

View File

@ -1,17 +1,19 @@
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
platform: "linux/amd64"
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0"
}
writeArch: dagger.#Exec & {
writeArch: core.#Exec & {
input: image.output
always: true
args: [
@ -21,7 +23,7 @@ dagger.#Plan & {
]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: writeArch.output
path: "/arch.txt"
} & {

View File

@ -1,17 +1,19 @@
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
platform: "linux/arm64"
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0"
}
writeArch: dagger.#Exec & {
writeArch: core.#Exec & {
input: image.output
always: true
args: [
@ -21,7 +23,7 @@ dagger.#Plan & {
]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: writeArch.output
path: "/arch.txt"
} & {

View File

@ -2,18 +2,19 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
params: foo: string
_image: dagger.#Pull & {
_image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: {
[string]: dagger.#Exec & {
[string]: core.#Exec & {
input: _image.output
env: FOO: string
args: [

View File

@ -63,7 +63,7 @@ setup() {
@test "task: #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_heredoc.cue verify
"$DAGGER" "do" -p ./dockerfile_path.cue verify

View File

@ -2,15 +2,16 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
exec: dagger.#Exec & {
exec: core.#Exec & {
input: image.output
args: [
"sh", "-c",
@ -20,7 +21,7 @@ dagger.#Plan & {
]
}
test: {
verify_file: dagger.#ReadFile & {
verify_file: core.#ReadFile & {
input: exec.output
path: "/output.txt"
} & {
@ -28,14 +29,14 @@ dagger.#Plan & {
contents: "hello world"
}
copy: dagger.#Copy & {
copy: core.#Copy & {
input: image.output
contents: exec.output
source: "/output.txt"
dest: "/output.txt"
}
verify_copy: dagger.#ReadFile & {
verify_copy: core.#ReadFile & {
input: copy.output
path: "/output.txt"
} & {

View File

@ -2,15 +2,16 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
exec: dagger.#Exec & {
exec: core.#Exec & {
input: image.output
args: [
"sh", "-c",
@ -21,7 +22,7 @@ dagger.#Plan & {
}
test: {
verify_file: dagger.#ReadFile & {
verify_file: core.#ReadFile & {
input: exec.output
path: "/output.txt"
} & {
@ -29,13 +30,13 @@ dagger.#Plan & {
contents: "hello world from dagger"
}
copy: dagger.#Copy & {
copy: core.#Copy & {
input: image.output
contents: exec.output
source: "/output.txt"
dest: "/output.txt"
}
verify_copy: dagger.#ReadFile & {
verify_copy: core.#ReadFile & {
input: copy.output
path: "/output.txt"
} & {

View File

@ -2,20 +2,21 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
alpine3_15_0: dagger.#Pull & {
alpine3_15_0: core.#Pull & {
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"
}
test: {
verify_alpine_3_15_0: dagger.#ReadFile & {
verify_alpine_3_15_0: core.#ReadFile & {
input: alpine3_15_0.output
path: "/etc/alpine-release"
} & {
@ -23,14 +24,14 @@ dagger.#Plan & {
contents: "3.15.0\n"
}
copy: dagger.#Copy & {
copy: core.#Copy & {
input: busybox1_34_1.output
contents: alpine3_15_0.output
source: "/etc/alpine-release"
dest: "/alpine3_15_0_release"
}
verify_copy: dagger.#ReadFile & {
verify_copy: core.#ReadFile & {
input: copy.output
path: "/alpine3_15_0_release"
} & {

View File

@ -2,18 +2,19 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
alpineBase: dagger.#Pull & {
alpineBase: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
busyboxBase: dagger.#Pull & {
busyboxBase: core.#Pull & {
source: "busybox:1.34.1@sha256:1286c6d3c393023ef93c247724a6a2d665528144ffe07bacb741cc2b4edfefad"
}
exec1: dagger.#Exec & {
exec1: core.#Exec & {
input: alpineBase.output
args: [
"sh", "-c",
@ -23,7 +24,7 @@ dagger.#Plan & {
]
}
exec2: dagger.#Exec & {
exec2: core.#Exec & {
input: exec1.output
args: [
"sh", "-c",
@ -33,43 +34,43 @@ dagger.#Plan & {
]
}
removeme: dagger.#WriteFile & {
removeme: core.#WriteFile & {
input: dagger.#Scratch
path: "/removeme"
contents: "removeme"
}
test: {
diff: dagger.#Diff & {
diff: core.#Diff & {
lower: alpineBase.output
upper: exec2.output
}
verify_diff_foo: dagger.#ReadFile & {
verify_diff_foo: core.#ReadFile & {
input: diff.output
path: "/dir/foo"
} & {
contents: "foo"
}
verify_diff_bar: dagger.#ReadFile & {
verify_diff_bar: core.#ReadFile & {
input: diff.output
path: "/dir/bar"
} & {
contents: "bar"
}
mergediff: dagger.#Merge & {
mergediff: core.#Merge & {
inputs: [
busyboxBase.output,
removeme.output,
diff.output,
]
}
verify_remove: dagger.#Exec & {
verify_remove: core.#Exec & {
input: mergediff.output
args: ["test", "!", "-e", "/removeme"]
}
verify_no_alpine_base: dagger.#Exec & {
verify_no_alpine_base: core.#Exec & {
input: mergediff.output
// make sure the the Diff actually separated files from the base
// by testing the non-existence of a file that only exists in the

View File

@ -2,12 +2,13 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: testdata: read: contents: dagger.#FS
actions: build: dagger.#Dockerfile & {
actions: build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
dockerfile: contents: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d

View File

@ -2,6 +2,7 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -15,12 +16,12 @@ dagger.#Plan & {
}
actions: {
sopsSecrets: dagger.#DecodeSecret & {
sopsSecrets: core.#DecodeSecret & {
format: "yaml"
input: client.commands.sops.stdout
}
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
auth: "daggerio/ci-test:private-pull": {
username: "daggertest"

View File

@ -2,17 +2,18 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: testdata: read: contents: dagger.#FS
actions: {
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: build.output
args: ["sh", "-c", "test $(cat /dir/foo) = foobar"]
}

View File

@ -2,18 +2,19 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: testdata: read: contents: dagger.#FS
actions: {
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
dockerfile: path: "./dockerfilepath/Dockerfile.custom"
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: build.output
args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
}

View File

@ -2,6 +2,7 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -9,7 +10,7 @@ dagger.#Plan & {
actions: {
// FIXME: this doesn't test anything beside not crashing
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
dockerfile: contents: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d

View File

@ -2,13 +2,14 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: testdata: read: contents: dagger.#FS
actions: {
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
dockerfile: contents: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
@ -16,7 +17,7 @@ dagger.#Plan & {
"""
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: build.output
args: ["sh", "-c", "test $(cat /output) = foobar"]
}

View File

@ -2,13 +2,14 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: testdata: read: contents: dagger.#FS
actions: {
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
dockerfile: contents: """
# syntax = docker/dockerfile:1.3
@ -17,7 +18,7 @@ dagger.#Plan & {
"""
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: build.output
args: ["sh", "-c", "test $(cat /output) = foobar"]
}

View File

@ -2,6 +2,7 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -9,7 +10,7 @@ dagger.#Plan & {
actions: {
// FIXME: this doesn't test anything beside not crashing
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
dockerfile: contents: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d

View File

@ -2,6 +2,7 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -9,7 +10,7 @@ dagger.#Plan & {
actions: {
// FIXME: this doesn't test anything beside not crashing
build: dagger.#Dockerfile & {
build: core.#Dockerfile & {
source: client.filesystem.testdata.read.contents
dockerfile: contents: """
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d

View File

@ -2,20 +2,21 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
exec: dagger.#Exec & {
exec: core.#Exec & {
input: image.output
args: ["sh", "-c", "echo -n hello world > /output.txt"]
}
verify: dagger.#ReadFile & {
verify: core.#ReadFile & {
input: exec.output
path: "/output.txt"
} & {

View File

@ -2,15 +2,16 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
env: TEST: "hello world"
args: [

View File

@ -2,17 +2,18 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: "secret.txt": read: contents: dagger.#Secret
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
env: TEST: client.filesystem."secret.txt".read.contents
args: [

View File

@ -2,15 +2,16 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
hosts: "unit.test": "1.2.3.4"
args: [

View File

@ -2,19 +2,20 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
sharedCache: dagger.#CacheDir & {
sharedCache: core.#CacheDir & {
id: "mycache"
}
exec: dagger.#Exec & {
exec: core.#Exec & {
input: image.output
mounts: cache: {
dest: "/cache"
@ -29,7 +30,7 @@ dagger.#Plan & {
}
test: {
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
mounts: cache: {
dest: "/cache"
@ -44,10 +45,10 @@ dagger.#Plan & {
]
}
otherCache: dagger.#CacheDir & {
otherCache: core.#CacheDir & {
id: "othercache"
}
verifyOtherCache: dagger.#Exec & {
verifyOtherCache: core.#Exec & {
input: image.output
mounts: cache: {
dest: "/cache"

View File

@ -2,15 +2,16 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
exec: dagger.#Exec & {
exec: core.#Exec & {
input: image.output
args: [
"sh", "-c",
@ -21,7 +22,7 @@ dagger.#Plan & {
}
test: {
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
mounts: fs: {
dest: "/target"
@ -36,7 +37,7 @@ dagger.#Plan & {
]
}
verifyRO: dagger.#Exec & {
verifyRO: core.#Exec & {
input: image.output
mounts: fs: {
dest: "/target"
@ -54,7 +55,7 @@ dagger.#Plan & {
]
}
verifySource: dagger.#Exec & {
verifySource: core.#Exec & {
input: image.output
mounts: fs: {
dest: "/target.txt"

View File

@ -2,17 +2,18 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: env: TESTSECRET: dagger.#Secret
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
test: {
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"
@ -27,7 +28,7 @@ dagger.#Plan & {
]
}
verifyPerm: dagger.#Exec & {
verifyPerm: core.#Exec & {
input: image.output
mounts: secret: {
dest: "/run/secrets/test"

View File

@ -2,22 +2,23 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: filesystem: "/var/run/docker.sock": read: contents: dagger.#Service
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
imageWithDocker: dagger.#Exec & {
imageWithDocker: core.#Exec & {
input: image.output
args: ["apk", "add", "--no-cache", "docker-cli"]
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: imageWithDocker.output
mounts: docker: {
dest: "/var/run/docker.sock"

View File

@ -2,19 +2,20 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
exec: dagger.#Exec & {
exec: core.#Exec & {
input: image.output
mounts: temp: {
dest: "/temp"
contents: dagger.#TempDir
contents: core.#TempDir
}
args: [
"sh", "-c",
@ -24,7 +25,7 @@ dagger.#Plan & {
]
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: exec.output
args: [
"sh", "-c",

View File

@ -2,20 +2,21 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
addUser: dagger.#Exec & {
addUser: core.#Exec & {
input: image.output
args: ["adduser", "-D", "test"]
}
test: {
verifyUsername: dagger.#Exec & {
verifyUsername: core.#Exec & {
input: addUser.output
user: "test"
args: [
@ -26,7 +27,7 @@ dagger.#Plan & {
]
}
verifyUserID: dagger.#Exec & {
verifyUserID: core.#Exec & {
input: addUser.output
user: "1000"
args: [

View File

@ -2,15 +2,16 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
workdir: "/tmp"
args: [

View File

@ -2,21 +2,22 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: test: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15"
}
export: dagger.#Export & {
export: core.#Export & {
input: image.output
config: image.config
tag: "example"
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
mounts: exported: {
contents: export.output

View File

@ -2,10 +2,11 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: badref: dagger.#GitPull & {
actions: badref: core.#GitPull & {
remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "lalalalal"
}

View File

@ -2,10 +2,11 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: badremote: dagger.#GitPull & {
actions: badremote: core.#GitPull & {
remote: "https://github.com/blocklayerhq/lalalala.git"
ref: "master"
}

View File

@ -2,10 +2,11 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: gitPull: dagger.#GitPull & {
actions: gitPull: core.#GitPull & {
remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "master"
}

View File

@ -2,26 +2,27 @@ package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
repo1: dagger.#GitPull & {
repo1: core.#GitPull & {
remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "master"
}
repo2: dagger.#GitPull & {
repo2: core.#GitPull & {
remote: "https://github.com/blocklayerhq/acme-clothing.git"
ref: "master"
keepGitDir: true
}
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0"
}
verify: dagger.#Exec & {
verify: core.#Exec & {
input: image.output
args: ["sh", "-c", """
set -eu

View File

@ -2,8 +2,9 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: invalid: dagger.#GitPull & {}
actions: invalid: core.#GitPull & {}
}

View File

@ -2,6 +2,7 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
@ -13,16 +14,16 @@ dagger.#Plan & {
actions: {
alpine: dagger.#Pull & {
alpine: core.#Pull & {
source: "alpine:3.15.0"
}
sopsSecrets: dagger.#DecodeSecret & {
sopsSecrets: core.#DecodeSecret & {
format: "yaml"
input: client.commands.sops.stdout
}
testRepo: dagger.#GitPull & {
testRepo: core.#GitPull & {
remote: "https://github.com/dagger/dagger.git"
ref: "main"
auth: {
@ -31,7 +32,7 @@ dagger.#Plan & {
}
}
testContent: dagger.#Exec & {
testContent: core.#Exec & {
input: alpine.output
always: true
args: ["ls", "-l", "/repo/README.md"]

View File

@ -2,21 +2,22 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"testing.dagger.io/hidden"
)
dagger.#Plan & {
actions: {
pull: dagger.#Pull & {
pull: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
_write: dagger.#WriteFile & {
_write: core.#WriteFile & {
input: pull.output
path: "/testing"
contents: "1,2,3"
permissions: 700
}
readfile: dagger.#ReadFile & {
readfile: core.#ReadFile & {
input: _write.output
path: "/testing"
} & {

View File

@ -2,10 +2,11 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: fetch: dagger.#HTTPFetch & {
actions: fetch: core.#HTTPFetch & {
source: "https://releases.dagger.io/dagger/latest_version"
dest: "/latest.html"
}

View File

@ -2,10 +2,11 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: fetch: dagger.#HTTPFetch & {
actions: fetch: core.#HTTPFetch & {
source: "https://releases.dagger.io/dagger/asfgdsfg"
dest: "/latest.html"
}

View File

@ -2,15 +2,16 @@ package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
actions: {
image: dagger.#Pull & {
image: core.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
exec: dagger.#Exec & {
exec: core.#Exec & {
input: image.output
args: [
"sh", "-c",
@ -20,31 +21,31 @@ dagger.#Plan & {
]
}
dir: dagger.#Mkdir & {
dir: core.#Mkdir & {
input: dagger.#Scratch
path: "/dir"
}
dirfoo: dagger.#WriteFile & {
dirfoo: core.#WriteFile & {
input: dir.output
path: "/dir/foo"
contents: "foo"
}
dirfoo2: dagger.#WriteFile & {
dirfoo2: core.#WriteFile & {
input: dir.output
path: "/dir/foo"
contents: "foo2"
}
dirbar: dagger.#WriteFile & {
dirbar: core.#WriteFile & {
input: dir.output
path: "/dir/bar"
contents: "bar"
}
test: {
merge: dagger.#Merge & {
merge: core.#Merge & {
inputs: [
dir.output,
dirfoo.output,
@ -54,19 +55,19 @@ dagger.#Plan & {
]
}
verify_merge_output: dagger.#ReadFile & {
verify_merge_output: core.#ReadFile & {
input: merge.output
path: "/output.txt"
} & {
contents: "hello world"
}
verify_merge_dirbar: dagger.#ReadFile & {
verify_merge_dirbar: core.#ReadFile & {
input: merge.output
path: "/dir/bar"
} & {
contents: "bar"
}
verify_merge_dirfoo: dagger.#ReadFile & {
verify_merge_dirfoo: core.#ReadFile & {
input: merge.output
path: "/dir/foo"
} & {

Some files were not shown because too many files have changed in this diff Show More