Merge pull request #1704 from helderco/inputs-outputs-cleanup
Inputs/outputs cleanup
This commit is contained in:
@@ -31,11 +31,6 @@ dagger.#Plan & {
|
||||
input: write.output
|
||||
path: "out.txt"
|
||||
}
|
||||
// FIXME: hack until we can do outputs with `dagger do`
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
args: ["echo", client.filesystem."test.txt".write.contents]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,17 +19,10 @@ dagger.#Plan & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
test: {
|
||||
fs: {
|
||||
data: dagger.#WriteFile & {
|
||||
input: dagger.#Scratch
|
||||
path: "/test"
|
||||
contents: "foobar"
|
||||
}
|
||||
// FIXME: hack until we can do outputs with `dagger do`
|
||||
verify: dagger.#ReadFile & {
|
||||
input: client.filesystem."out_fs".write.contents
|
||||
path: "test"
|
||||
}
|
||||
fs: data: dagger.#WriteFile & {
|
||||
input: dagger.#Scratch
|
||||
path: "/test"
|
||||
contents: "foobar"
|
||||
}
|
||||
file: {
|
||||
// Only using contents for reference in client
|
||||
@@ -38,11 +31,6 @@ dagger.#Plan & {
|
||||
path: "/test"
|
||||
contents: "foobaz"
|
||||
}
|
||||
// FIXME: hack until we can do outputs with `dagger do`
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
args: ["echo", "-c", client.filesystem."out_files/test.txt".write.contents]
|
||||
}
|
||||
}
|
||||
secret: {
|
||||
create: dagger.#WriteFile & {
|
||||
@@ -54,15 +42,6 @@ dagger.#Plan & {
|
||||
input: create.output
|
||||
path: "/test"
|
||||
}
|
||||
// FIXME: hack until we can do outputs with `dagger do`
|
||||
verify: dagger.#Exec & {
|
||||
input: image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
contents: client.filesystem."out_files/secret.txt".write.contents
|
||||
}
|
||||
args: ["id"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +0,0 @@
|
||||
package main
|
||||
|
||||
inputs: directories: test: path: "./fasdfsdfs"
|
@@ -1,32 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
inputs: directories: test: path: string
|
||||
|
||||
actions: {
|
||||
// Test that file exists and contains correct content
|
||||
exists: dagger.#ReadFile & {
|
||||
input: inputs.directories.test.contents
|
||||
path: "test.txt"
|
||||
contents: "local directory"
|
||||
}
|
||||
|
||||
// Test that file does NOT exist
|
||||
notExists: dagger.#ReadFile & {
|
||||
input: inputs.directories.test.contents
|
||||
path: "test.txt"
|
||||
contents: "local directory"
|
||||
}
|
||||
|
||||
// Test that file exists and contains conflicting content
|
||||
conflictingValues: dagger.#ReadFile & {
|
||||
input: inputs.directories.test.contents
|
||||
path: "test.txt"
|
||||
contents: "local dfsadf"
|
||||
}
|
||||
}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
local directory
|
@@ -1,3 +0,0 @@
|
||||
package main
|
||||
|
||||
inputs: directories: test: path: "."
|
@@ -1,59 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
inputs: secrets: {
|
||||
echo: command: {
|
||||
name: "echo"
|
||||
args: ["hello europa"]
|
||||
}
|
||||
|
||||
relative: command: {
|
||||
name: "cat"
|
||||
args: ["./test.txt"]
|
||||
}
|
||||
|
||||
badCommand: command: {
|
||||
name: "rtyet" // should fail because command doesn't exist
|
||||
args: ["hello europa"]
|
||||
}
|
||||
|
||||
badArgs: command: {
|
||||
name: "cat"
|
||||
args: ["--sfgjkhf"] // // should fail because invalid option
|
||||
}
|
||||
}
|
||||
|
||||
actions: {
|
||||
|
||||
_image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
test: {
|
||||
|
||||
[string]: dagger.#Exec & {
|
||||
input: _image.output
|
||||
mounts: secret: {
|
||||
dest: "/run/secrets/test"
|
||||
// contents: inputs.secrets.echo.contents
|
||||
}
|
||||
args: [
|
||||
"sh", "-c",
|
||||
#"""
|
||||
test "$(cat /run/secrets/test)" = "hello europa"
|
||||
ls -l /run/secrets/test | grep -- "-r--------"
|
||||
"""#,
|
||||
]
|
||||
}
|
||||
|
||||
valid: mounts: secret: contents: inputs.secrets.echo.contents
|
||||
relative: mounts: secret: contents: inputs.secrets.relative.contents
|
||||
badCommand: mounts: secret: contents: inputs.secrets.badCommand.contents
|
||||
badArgs: mounts: secret: contents: inputs.secrets.badArgs.contents
|
||||
}
|
||||
}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
hello europa
|
1
tests/plan/outputs/directories/.gitignore
vendored
1
tests/plan/outputs/directories/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
out
|
@@ -1,19 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
actions: data: dagger.#WriteFile & {
|
||||
input: dagger.#Scratch
|
||||
path: "/test_outputs"
|
||||
permissions: 0o600
|
||||
contents: "foobar"
|
||||
}
|
||||
|
||||
outputs: directories: test_outputs: {
|
||||
contents: actions.data.output
|
||||
dest: "./out"
|
||||
}
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
actions: data: dagger.#WriteFile & {
|
||||
input: dagger.#Scratch
|
||||
path: "/test_relative"
|
||||
permissions: 0o600
|
||||
contents: "foobar"
|
||||
}
|
||||
|
||||
outputs: directories: test_relative: {
|
||||
contents: actions.data.output
|
||||
dest: "./out"
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
package main
|
||||
|
||||
import "dagger.io/dagger"
|
||||
|
||||
dagger.#Plan & {
|
||||
outputs: files: test: {
|
||||
contents: "foobar"
|
||||
dest: "./test_default_permissions"
|
||||
}
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
package main
|
||||
|
||||
import "dagger.io/dagger"
|
||||
|
||||
dagger.#Plan & {
|
||||
outputs: files: test: dest: "./test_no_contents"
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package main
|
||||
|
||||
import "dagger.io/dagger"
|
||||
|
||||
dagger.#Plan & {
|
||||
outputs: files: {
|
||||
[path=string]: dest: path
|
||||
test_relative: contents: """
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
echo "Hello World!"
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package main
|
||||
|
||||
import "dagger.io/dagger"
|
||||
|
||||
dagger.#Plan & {
|
||||
outputs: files: {
|
||||
[path=string]: dest: path
|
||||
test_usage: {
|
||||
contents: """
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
echo "Hello World!"
|
||||
|
||||
"""
|
||||
permissions: 0o750
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
// "alpha.dagger.io/dagger/op"
|
||||
// "alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
// should fail due to incomplete service
|
||||
proxy: dockerSocket: {}
|
||||
|
||||
actions: {
|
||||
image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
imageWithDocker: dagger.#Exec & {
|
||||
input: image.output
|
||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: imageWithDocker.output
|
||||
mounts: docker: {
|
||||
dest: "/var/run/docker.sock"
|
||||
contents: proxy.dockerSocket.service
|
||||
}
|
||||
args: ["docker", "info"]
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
// "alpha.dagger.io/dagger/op"
|
||||
// "alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
// should fail because incomplete value
|
||||
proxy: dockerSocket: unix: string
|
||||
|
||||
actions: {
|
||||
image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
imageWithDocker: dagger.#Exec & {
|
||||
input: image.output
|
||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: imageWithDocker.output
|
||||
mounts: docker: {
|
||||
dest: "/var/run/docker.sock"
|
||||
contents: proxy.dockerSocket.service
|
||||
}
|
||||
args: ["docker", "info"]
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
// "alpha.dagger.io/dagger/op"
|
||||
// "alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
// should fail because of misspelled key
|
||||
proxy: dockerSocket: unx: "/var/run/docker.sock"
|
||||
|
||||
actions: {
|
||||
image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
imageWithDocker: dagger.#Exec & {
|
||||
input: image.output
|
||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: imageWithDocker.output
|
||||
mounts: docker: {
|
||||
dest: "/var/run/docker.sock"
|
||||
contents: proxy.dockerSocket.service
|
||||
}
|
||||
args: ["docker", "info"]
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
// "alpha.dagger.io/dagger/op"
|
||||
// "alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
// should fail because of misspelled value
|
||||
proxy: dockerSocket: unix: "/var/run/docker.soc"
|
||||
|
||||
actions: {
|
||||
image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
imageWithDocker: dagger.#Exec & {
|
||||
input: image.output
|
||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: imageWithDocker.output
|
||||
mounts: docker: {
|
||||
dest: "/var/run/docker.sock"
|
||||
contents: proxy.dockerSocket.service
|
||||
}
|
||||
args: ["docker", "info"]
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
// "alpha.dagger.io/dagger/op"
|
||||
// "alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
// should succeed
|
||||
proxy: dockerSocket: unix: "/var/run/docker.sock"
|
||||
|
||||
actions: {
|
||||
image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
|
||||
imageWithDocker: dagger.#Exec & {
|
||||
input: image.output
|
||||
args: ["apk", "add", "--no-cache", "docker-cli"]
|
||||
}
|
||||
|
||||
verify: dagger.#Exec & {
|
||||
input: imageWithDocker.output
|
||||
mounts: docker: {
|
||||
dest: "/var/run/docker.sock"
|
||||
contents: proxy.dockerSocket.service
|
||||
}
|
||||
args: ["docker", "info"]
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,9 +5,9 @@ import (
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
inputs: params: foo: string
|
||||
|
||||
actions: {
|
||||
params: foo: string
|
||||
|
||||
_image: dagger.#Pull & {
|
||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
}
|
||||
@@ -25,7 +25,7 @@ dagger.#Plan & {
|
||||
}
|
||||
|
||||
direct: {}
|
||||
params: env: FOO: inputs.params.foo
|
||||
"params": env: FOO: params.foo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user