Move core actions to a subpackage

Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
Helder Correia
2022-03-26 14:09:21 -01:00
parent 9f042800da
commit b3bdd347e7
121 changed files with 469 additions and 340 deletions

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: [