tests: migrate ops test to bats
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
45
tests/ops/copy/invalid/cache/main.cue
vendored
Normal file
45
tests/ops/copy/invalid/cache/main.cue
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
package testing
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
src: "/etc/issue"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: [{do: "fetch-container", ref: "busybox"}]
|
||||
src: "/etc/issue"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
65
tests/ops/copy/valid/component/main.cue
Normal file
65
tests/ops/copy/valid/component/main.cue
Normal file
@@ -0,0 +1,65 @@
|
||||
package testing
|
||||
|
||||
component: #up: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: component
|
||||
src: "/id"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: #up: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
src: "/id"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
23
tests/ops/copy/valid/script/main.cue
Normal file
23
tests/ops/copy/valid/script/main.cue
Normal file
@@ -0,0 +1,23 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
{
|
||||
do: "copy"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
src: "/etc/issue"
|
||||
dest: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
122
tests/ops/dockerbuild/main.cue
Normal file
122
tests/ops/dockerbuild/main.cue
Normal file
@@ -0,0 +1,122 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
// Set to `--input-dir=./tests/dockerbuild/testdata`
|
||||
TestData: dagger.#Artifact
|
||||
|
||||
TestInlinedDockerfile: #up: [
|
||||
op.#DockerBuild & {
|
||||
dockerfile: """
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
RUN echo hello world
|
||||
"""
|
||||
},
|
||||
]
|
||||
|
||||
TestOpChaining: #up: [
|
||||
op.#DockerBuild & {
|
||||
dockerfile: """
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
RUN echo foobar > /output
|
||||
"""
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "test $(cat /output) = foobar"]
|
||||
},
|
||||
]
|
||||
|
||||
TestBuildContext: #up: [
|
||||
op.#DockerBuild & {
|
||||
context: TestData
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "test $(cat /dir/foo) = foobar"]
|
||||
},
|
||||
]
|
||||
|
||||
TestBuildContextAndDockerfile: #up: [
|
||||
op.#DockerBuild & {
|
||||
context: TestData
|
||||
dockerfile: """
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
COPY foo /override
|
||||
"""
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "test $(cat /override) = foobar"]
|
||||
},
|
||||
]
|
||||
|
||||
TestDockerfilePath: #up: [
|
||||
op.#DockerBuild & {
|
||||
context: TestData
|
||||
dockerfilePath: "./dockerfilepath/Dockerfile.custom"
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "test $(cat /test) = dockerfilePath"]
|
||||
},
|
||||
]
|
||||
|
||||
TestBuildArgs: #up: [
|
||||
op.#DockerBuild & {
|
||||
dockerfile: """
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
ARG TEST=foo
|
||||
RUN test "${TEST}" = "bar"
|
||||
"""
|
||||
buildArg: TEST: "bar"
|
||||
},
|
||||
]
|
||||
|
||||
// FIXME: this doesn't test anything beside not crashing
|
||||
TestBuildLabels: #up: [
|
||||
op.#DockerBuild & {
|
||||
dockerfile: """
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
"""
|
||||
label: FOO: "bar"
|
||||
},
|
||||
]
|
||||
|
||||
// FIXME: this doesn't test anything beside not crashing
|
||||
TestBuildPlatform: #up: [
|
||||
op.#DockerBuild & {
|
||||
dockerfile: """
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
"""
|
||||
platforms: ["linux/amd64"]
|
||||
},
|
||||
]
|
||||
|
||||
TestImageMetadata: #up: [
|
||||
op.#DockerBuild & {
|
||||
dockerfile: """
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
ENV CHECK foobar
|
||||
ENV DOUBLECHECK test
|
||||
"""
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", #"""
|
||||
env
|
||||
test "$CHECK" = "foobar"
|
||||
"""#]
|
||||
},
|
||||
]
|
||||
|
||||
// Make sure the metadata is carried over with a `Load`
|
||||
TestImageMetadataIndirect: #up: [
|
||||
op.#Load & {
|
||||
from: TestImageMetadata
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", #"""
|
||||
env
|
||||
test "$DOUBLECHECK" = "test"
|
||||
"""#]
|
||||
},
|
||||
]
|
3
tests/ops/dockerbuild/testdata/Dockerfile
vendored
Normal file
3
tests/ops/dockerbuild/testdata/Dockerfile
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
COPY . /dir
|
||||
RUN test $(cat /dir/foo) = foobar
|
2
tests/ops/dockerbuild/testdata/dockerfilepath/Dockerfile.custom
vendored
Normal file
2
tests/ops/dockerbuild/testdata/dockerfilepath/Dockerfile.custom
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
RUN echo dockerfilePath > /test
|
1
tests/ops/dockerbuild/testdata/foo
vendored
Normal file
1
tests/ops/dockerbuild/testdata/foo
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foobar
|
13
tests/ops/exec/always/main.cue
Normal file
13
tests/ops/exec/always/main.cue
Normal file
@@ -0,0 +1,13 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["echo", "always output"]
|
||||
always: true
|
||||
},
|
||||
]
|
16
tests/ops/exec/dir/doesnotexist/main.cue
Normal file
16
tests/ops/exec/dir/doesnotexist/main.cue
Normal file
@@ -0,0 +1,16 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "pwd is: $(pwd)"
|
||||
[ "$(pwd)" == "/thisisnonexistent" ] || exit 1
|
||||
"""]
|
||||
dir: "/thisisnonexistent"
|
||||
},
|
||||
]
|
16
tests/ops/exec/dir/exist/main.cue
Normal file
16
tests/ops/exec/dir/exist/main.cue
Normal file
@@ -0,0 +1,16 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "pwd is: $(pwd)"
|
||||
[ "$(pwd)" == "/etc" ] || exit 1
|
||||
"""]
|
||||
dir: "/etc"
|
||||
},
|
||||
]
|
15
tests/ops/exec/env/invalid/main.cue
vendored
Normal file
15
tests/ops/exec/env/invalid/main.cue
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", #"""
|
||||
echo "$foo"
|
||||
"""#]
|
||||
env: foo: lala: "lala"
|
||||
},
|
||||
]
|
18
tests/ops/exec/env/overlay/main.cue
vendored
Normal file
18
tests/ops/exec/env/overlay/main.cue
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
package testing
|
||||
|
||||
bar: string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "foo: $foo"
|
||||
[ "$foo" == "overlay environment" ] || exit 1
|
||||
"""]
|
||||
env: foo: bar
|
||||
},
|
||||
]
|
15
tests/ops/exec/env/valid/main.cue
vendored
Normal file
15
tests/ops/exec/env/valid/main.cue
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
[ "$foo" == "output environment" ] || exit 1
|
||||
"""]
|
||||
env: foo: "output environment"
|
||||
},
|
||||
]
|
12
tests/ops/exec/error/main.cue
Normal file
12
tests/ops/exec/error/main.cue
Normal file
@@ -0,0 +1,12 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["erroringout"]
|
||||
},
|
||||
]
|
14
tests/ops/exec/exit_code/main.cue
Normal file
14
tests/ops/exec/exit_code/main.cue
Normal file
@@ -0,0 +1,14 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", "exit 123"]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
]
|
11
tests/ops/exec/invalid/main.cue
Normal file
11
tests/ops/exec/invalid/main.cue
Normal file
@@ -0,0 +1,11 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
},
|
||||
]
|
12
tests/ops/exec/simple/main.cue
Normal file
12
tests/ops/exec/simple/main.cue
Normal file
@@ -0,0 +1,12 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["echo", "simple output"]
|
||||
},
|
||||
]
|
@@ -0,0 +1,20 @@
|
||||
package testing
|
||||
|
||||
hello: "world"
|
||||
bar: string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo \(hello)
|
||||
echo "This test SHOULD fail, because this script SHOULD execute, since bar is not referenced"
|
||||
exit 1
|
||||
"""]
|
||||
},
|
||||
]
|
20
tests/ops/exec/undefined/non_concrete_referenced/main.cue
Normal file
20
tests/ops/exec/undefined/non_concrete_referenced/main.cue
Normal file
@@ -0,0 +1,20 @@
|
||||
package testing
|
||||
|
||||
hello: "world"
|
||||
bar: string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo \(bar)
|
||||
echo "This test SHOULD succeed, because this is never going to be executed, as \(bar) is not concrete"
|
||||
exit 1
|
||||
"""]
|
||||
},
|
||||
]
|
1
tests/ops/exec/undefined/with_pkg_def/cue.mod/module.cue
Normal file
1
tests/ops/exec/undefined/with_pkg_def/cue.mod/module.cue
Normal file
@@ -0,0 +1 @@
|
||||
module: "dagger.io/testing"
|
@@ -0,0 +1,17 @@
|
||||
package def
|
||||
|
||||
#dang: string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo success
|
||||
"""]
|
||||
},
|
||||
]
|
12
tests/ops/exec/undefined/with_pkg_def/main.cue
Normal file
12
tests/ops/exec/undefined/with_pkg_def/main.cue
Normal file
@@ -0,0 +1,12 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"dagger.io/def"
|
||||
)
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load",
|
||||
from: def
|
||||
},
|
||||
]
|
@@ -0,0 +1 @@
|
||||
module: "dagger.io/testing"
|
@@ -0,0 +1,18 @@
|
||||
package nonoptional
|
||||
|
||||
dang: string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo "This test SHOULD fail, because this SHOULD be executed"
|
||||
exit 1
|
||||
"""]
|
||||
},
|
||||
]
|
12
tests/ops/exec/undefined/with_pkg_mandatory/main.cue
Normal file
12
tests/ops/exec/undefined/with_pkg_mandatory/main.cue
Normal file
@@ -0,0 +1,12 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"dagger.io/nonoptional"
|
||||
)
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load",
|
||||
from: nonoptional
|
||||
},
|
||||
]
|
@@ -0,0 +1 @@
|
||||
module: "dagger.io/testing"
|
@@ -0,0 +1,17 @@
|
||||
package optional
|
||||
|
||||
dang?: string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
dir: "/"
|
||||
args: ["sh", "-c", """
|
||||
echo success
|
||||
"""]
|
||||
},
|
||||
]
|
12
tests/ops/exec/undefined/with_pkg_optional/main.cue
Normal file
12
tests/ops/exec/undefined/with_pkg_optional/main.cue
Normal file
@@ -0,0 +1,12 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"dagger.io/optional"
|
||||
)
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load",
|
||||
from: optional
|
||||
},
|
||||
]
|
26
tests/ops/export/bool/main.cue
Normal file
26
tests/ops/export/bool/main.cue
Normal file
@@ -0,0 +1,26 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
bool
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf "true" > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
241
tests/ops/export/concurrency/main.cue
Normal file
241
tests/ops/export/concurrency/main.cue
Normal file
@@ -0,0 +1,241 @@
|
||||
package testing
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol1 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol2 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test3: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol3 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test4: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol4 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test5: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol5 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test6: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol6 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test7: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol7 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test8: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol8 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test9: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol9 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test10: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo lol10 > /tmp/out
|
||||
"""]
|
||||
dir: "/"
|
||||
always: true
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
25
tests/ops/export/float/main.cue
Normal file
25
tests/ops/export/float/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
float
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo -123.5 > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
25
tests/ops/export/invalid/format/main.cue
Normal file
25
tests/ops/export/invalid/format/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "lalalalal"
|
||||
},
|
||||
]
|
||||
}
|
18
tests/ops/export/invalid/path/main.cue
Normal file
18
tests/ops/export/invalid/path/main.cue
Normal file
@@ -0,0 +1,18 @@
|
||||
package testing
|
||||
|
||||
teststring: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/lalala"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
26
tests/ops/export/invalid/validation/main.cue
Normal file
26
tests/ops/export/invalid/validation/main.cue
Normal file
@@ -0,0 +1,26 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~"^NAAAA.+"
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
73
tests/ops/export/json/main.cue
Normal file
73
tests/ops/export/json/main.cue
Normal file
@@ -0,0 +1,73 @@
|
||||
package testing
|
||||
|
||||
testScalar: {
|
||||
bool
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo true > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
testMap: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo '{"something": "something"}' > /tmp/out
|
||||
""",
|
||||
]
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
|
||||
// FIXME: lists are currently broken
|
||||
// testList: {
|
||||
// [...string]
|
||||
|
||||
// #up: [
|
||||
// {
|
||||
// do: "fetch-container"
|
||||
// ref: "alpine"
|
||||
// },
|
||||
// {
|
||||
// do: "exec"
|
||||
// args: ["sh", "-c", """
|
||||
// echo '["milk", "pumpkin pie", "eggs", "juice"]' > /tmp/out
|
||||
// """,
|
||||
// ]
|
||||
// dir: "/"
|
||||
// },
|
||||
// {
|
||||
// do: "export"
|
||||
// // Source path in the container
|
||||
// source: "/tmp/out"
|
||||
// format: "json"
|
||||
// },
|
||||
// ]
|
||||
// }
|
25
tests/ops/export/number/main.cue
Normal file
25
tests/ops/export/number/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
number
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo -123.5 > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "json"
|
||||
},
|
||||
]
|
||||
}
|
25
tests/ops/export/string/main.cue
Normal file
25
tests/ops/export/string/main.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
26
tests/ops/export/withvalidation/main.cue
Normal file
26
tests/ops/export/withvalidation/main.cue
Normal file
@@ -0,0 +1,26 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
=~"^some.+"
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
75
tests/ops/export/yaml/main.cue
Normal file
75
tests/ops/export/yaml/main.cue
Normal file
@@ -0,0 +1,75 @@
|
||||
package testing
|
||||
|
||||
testScalar: {
|
||||
bool
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo true > /tmp/out
|
||||
""",
|
||||
]
|
||||
// XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
dir: "/"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "yaml"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// FIXME: lists are currently broken
|
||||
// testList: {
|
||||
// [...string]
|
||||
|
||||
// #up: [
|
||||
// {
|
||||
// do: "fetch-container"
|
||||
// ref: "alpine"
|
||||
// },
|
||||
// {
|
||||
// do: "exec"
|
||||
// args: ["sh", "-c", """
|
||||
// echo "--- # Shopping list
|
||||
// [milk, pumpkin pie, eggs, juice]" > /tmp/out
|
||||
// """,
|
||||
// ]
|
||||
// // XXX Blocked by https://github.com/blocklayerhq/dagger/issues/19
|
||||
// dir: "/"
|
||||
// },
|
||||
// {
|
||||
// do: "export"
|
||||
// // Source path in the container
|
||||
// source: "/tmp/out"
|
||||
// format: "yaml"
|
||||
// },
|
||||
// ]
|
||||
// }
|
||||
|
||||
testMap: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo something: something > /tmp/out
|
||||
""",
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
// Source path in the container
|
||||
source: "/tmp/out"
|
||||
format: "yaml"
|
||||
},
|
||||
]
|
36
tests/ops/fetch-container/exist/main.cue
Normal file
36
tests/ops/fetch-container/exist/main.cue
Normal file
@@ -0,0 +1,36 @@
|
||||
package testing
|
||||
|
||||
busybox1: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox"
|
||||
},
|
||||
]
|
||||
|
||||
busybox2: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox:latest"
|
||||
},
|
||||
]
|
||||
|
||||
busybox3: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox:1.33-musl"
|
||||
},
|
||||
]
|
||||
|
||||
busybox4: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
|
||||
},
|
||||
]
|
||||
|
||||
busybox5: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busybox:1.33-musl@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
|
||||
},
|
||||
]
|
7
tests/ops/fetch-container/invalid/main.cue
Normal file
7
tests/ops/fetch-container/invalid/main.cue
Normal file
@@ -0,0 +1,7 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
},
|
||||
]
|
8
tests/ops/fetch-container/nonexistent/digest/main.cue
Normal file
8
tests/ops/fetch-container/nonexistent/digest/main.cue
Normal file
@@ -0,0 +1,8 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine@sha256:c6c7524e2111f22a9f7577211232d89a9e68cf5b9ed4a41ba77957c9771380a5"
|
||||
},
|
||||
]
|
@@ -0,0 +1,10 @@
|
||||
package testing
|
||||
|
||||
// XXX WATCHOUT
|
||||
// Once buildkit has pulled that digest, it will stay cached and happily succeed WHATEVER the image name then is
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "busyboxaaa@sha256:e2af53705b841ace3ab3a44998663d4251d33ee8a9acaf71b66df4ae01c3bbe7"
|
||||
},
|
||||
]
|
8
tests/ops/fetch-container/nonexistent/image/main.cue
Normal file
8
tests/ops/fetch-container/nonexistent/image/main.cue
Normal file
@@ -0,0 +1,8 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "doesnotexist"
|
||||
},
|
||||
]
|
8
tests/ops/fetch-container/nonexistent/tag/main.cue
Normal file
8
tests/ops/fetch-container/nonexistent/tag/main.cue
Normal file
@@ -0,0 +1,8 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine:doesnotexist"
|
||||
},
|
||||
]
|
9
tests/ops/fetch-git/exist/main.cue
Normal file
9
tests/ops/fetch-git/exist/main.cue
Normal file
@@ -0,0 +1,9 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||
ref: "master"
|
||||
},
|
||||
]
|
7
tests/ops/fetch-git/invalid/main.cue
Normal file
7
tests/ops/fetch-git/invalid/main.cue
Normal file
@@ -0,0 +1,7 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
},
|
||||
]
|
9
tests/ops/fetch-git/nonexistent/bork/main.cue
Normal file
9
tests/ops/fetch-git/nonexistent/bork/main.cue
Normal file
@@ -0,0 +1,9 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "pork://pork"
|
||||
ref: "master"
|
||||
},
|
||||
]
|
9
tests/ops/fetch-git/nonexistent/ref/main.cue
Normal file
9
tests/ops/fetch-git/nonexistent/ref/main.cue
Normal file
@@ -0,0 +1,9 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||
ref: "lalalalal"
|
||||
},
|
||||
]
|
9
tests/ops/fetch-git/nonexistent/remote/main.cue
Normal file
9
tests/ops/fetch-git/nonexistent/remote/main.cue
Normal file
@@ -0,0 +1,9 @@
|
||||
package testing
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-git"
|
||||
remote: "https://github.com/blocklayerhq/lalalala.git"
|
||||
ref: "master"
|
||||
},
|
||||
]
|
33
tests/ops/load/invalid/cache/main.cue
vendored
Normal file
33
tests/ops/load/invalid/cache/main.cue
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
package testing
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/etc/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "busybox"}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/etc/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
53
tests/ops/load/valid/component/main.cue
Normal file
53
tests/ops/load/valid/component/main.cue
Normal file
@@ -0,0 +1,53 @@
|
||||
package testing
|
||||
|
||||
component: #up: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
|
||||
test1: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: component
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
test2: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: #up: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}, {
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
printf lol > /id
|
||||
"""]
|
||||
dir: "/"
|
||||
}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/id"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
17
tests/ops/load/valid/script/main.cue
Normal file
17
tests/ops/load/valid/script/main.cue
Normal file
@@ -0,0 +1,17 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/etc/issue"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
25
tests/ops/mounts/valid/cache/main.cue
vendored
Normal file
25
tests/ops/mounts/valid/cache/main.cue
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo "NOT SURE WHAT TO TEST YET" > /out
|
||||
"""]
|
||||
dir: "/"
|
||||
mount: something: "cache"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
35
tests/ops/mounts/valid/component/main.cue
Normal file
35
tests/ops/mounts/valid/component/main.cue
Normal file
@@ -0,0 +1,35 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
cat /mnt/test/lol > /out
|
||||
"""]
|
||||
mount: "/mnt/test": from: #up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo -n "hello world" > /lol
|
||||
"""]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
31
tests/ops/mounts/valid/script/main.cue
Normal file
31
tests/ops/mounts/valid/script/main.cue
Normal file
@@ -0,0 +1,31 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
ls -lA /lol > /out
|
||||
"""]
|
||||
dir: "/"
|
||||
mount: something: {
|
||||
input: [{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
}]
|
||||
path: "/lol"
|
||||
}
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
34
tests/ops/mounts/valid/tmpfs/main.cue
Normal file
34
tests/ops/mounts/valid/tmpfs/main.cue
Normal file
@@ -0,0 +1,34 @@
|
||||
package testing
|
||||
|
||||
test: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "load"
|
||||
from: [{do: "fetch-container", ref: "alpine"}]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
echo ok > /out
|
||||
echo ok > /tmpdir/out
|
||||
"""]
|
||||
dir: "/"
|
||||
mount: "/tmpdir": "tmpfs"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", """
|
||||
[ -f /out ] || exit 1
|
||||
# content of /cache/tmp must not exist in this layer
|
||||
[ ! -f /tmpdir/out ] || exit 1
|
||||
"""]
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
33
tests/ops/push-container/inputs.yaml
Normal file
33
tests/ops/push-container/inputs.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
registry:
|
||||
username: ENC[AES256_GCM,data:8AH6p9WHidanCA==,iv:ezThCQJv+bVBf8SdfSa2HFoP+eu6IZMPl5xvMOGDcps=,tag:mzR7xTKeQNDvkyd2Dm3AKw==,type:str]
|
||||
token: ENC[AES256_GCM,data:68d31b3EfnQJofIt6j+iBCtDyLOBWjFqvVmejyDjIOh8oBXP,iv:PMghC2nd7jqAzrQzm/PW1YdbE0VAbEBkK0/Ri1WwduI=,tag:0JH4WbcJHvgzF4VIK4deBg==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
lastmodified: '2021-03-18T22:59:59Z'
|
||||
mac: ENC[AES256_GCM,data:3++nHOAJaYFCEuUXim4/gOsG1ZVWt8Ab88qaqHM6jpCA2gLSyADWpB5iQfU9bM7Sq3PgCcWd5+mDHxl5Q8r9fiozrS025OLtsn7qQQQ84WaiFz9Y4Trsbe4EJXNpxYDXjLZEkEtkKs4/Dl+y2Ey3nVyIWKZEX9cPogJ64zfFS9Q=,iv:jvSwxJ8Of2Nfp1ijKItOraDO8aS6aGHQKFY61kF8JS8=,tag:I+AWPIZsPeXU30zxbgq2eQ==,type:str]
|
||||
pgp:
|
||||
- created_at: '2021-03-18T22:59:59Z'
|
||||
enc: |
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
hQIMAzqVY590vudzAQ//etnfnpfCo9rAkctR+Fwg/7VdVL3Rov+6gnyjUnoN1BS1
|
||||
8jnBF/86AZ7uK89dTcTZCsK1hKPxeYg1kJTKpA+zfDORupzTWcMrRyjwNk5wQ2Vg
|
||||
N1adUwFsBQpk8WptpsU/ro6+3yH+Nn35begs6hP2fH/EQ9XOxw5gY0kp0AFjGaKJ
|
||||
tRZVrr3f2hpLESo6LILRO97UXZiGcwTn5onslECL92260cU1nqEQp+ESK7XrdYIG
|
||||
99oM3eXEraKw4WuQDaDE6U135aUl6vIJWD1JZzyr3RW3+5O9pn5rpN3Wc0TbDR6+
|
||||
9Fs/TjuA1h5eJzbt+lkA74BtxPOBv9O7HJnWJpXjiG0VUGHdFXoq5Tr5Ol68RQxa
|
||||
BWe7IfTO6FHN0xOl1dY7cn5jtf+xlFjL86s9OkrJUFa9lbQx8L/QPCeA2Xiu4tpW
|
||||
+wTSel13k8Uv/JSGgLwSohW6N4XTQYdxPkO+a1V08adwFBXaGgqxfg0rNehcS5fp
|
||||
y3TEq84cOlBsaI+rYpnOTPEajtYWfTe8WFf+lBOn1vZ9EiupjZtefGX2MIWPXoaK
|
||||
kVBgRvzjp4/BY68yRvdi5sZFd2nakl+DOXzouuFbzsOkxL3o9FA9aCVsXtFqqzSG
|
||||
Hvq4ZJ5ivXf6vQf+s7Tgc4qxW2CQwIPZVkHhQossrWgtkQ4WDAyzfhF0YuhEnpLS
|
||||
XgGNLr82LMVmempaJd7GfAR2nwGnLUTYny1KoiW/1ie6DPwLZBX/UxPOplaS5wYH
|
||||
Xd3gV3smg5xZ7/rfvzKTzJ1a5yH6D3xI05UtnUWdqojONcXS9NS+P7RArngJwSs=
|
||||
=m0OS
|
||||
-----END PGP MESSAGE-----
|
||||
fp: 6CB37404020B5F0A0B41B5BB225EBAB0B936AC65
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.6.1
|
132
tests/ops/push-container/main.cue
Normal file
132
tests/ops/push-container/main.cue
Normal file
@@ -0,0 +1,132 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/op"
|
||||
"dagger.io/alpine"
|
||||
)
|
||||
|
||||
TestPushContainer: {
|
||||
// Generate a random number
|
||||
random: {
|
||||
string
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
|
||||
},
|
||||
op.#Export & {
|
||||
source: "/rand"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Push an image with a random tag
|
||||
push: {
|
||||
ref: "daggerio/ci-test:\(random)"
|
||||
#up: [
|
||||
op.#WriteFile & {
|
||||
content: random
|
||||
dest: "/rand"
|
||||
},
|
||||
op.#PushContainer & {
|
||||
"ref": ref
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Pull the image back
|
||||
pull: #up: [
|
||||
op.#FetchContainer & {
|
||||
ref: push.ref
|
||||
},
|
||||
]
|
||||
|
||||
// Check the content
|
||||
check: #up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
args: [
|
||||
"sh", "-c", #"""
|
||||
test "$(cat /src/rand)" = "\#(random)"
|
||||
"""#,
|
||||
]
|
||||
mount: "/src": from: pull
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Ensures image metadata is preserved in a push
|
||||
TestPushContainerMetadata: {
|
||||
// Generate a random number
|
||||
random: {
|
||||
string
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
|
||||
},
|
||||
op.#Export & {
|
||||
source: "/rand"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// `docker build` using an `ENV` and push the image
|
||||
push: {
|
||||
ref: "daggerio/ci-test:\(random)-dockerbuild"
|
||||
#up: [
|
||||
op.#DockerBuild & {
|
||||
dockerfile: #"""
|
||||
FROM alpine:latest@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
|
||||
ENV CHECK \#(random)
|
||||
"""#
|
||||
},
|
||||
op.#PushContainer & {
|
||||
"ref": ref
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Pull the image down and make sure the ENV is preserved
|
||||
check: #up: [
|
||||
op.#FetchContainer & {
|
||||
ref: push.ref
|
||||
},
|
||||
op.#Exec & {
|
||||
args: [
|
||||
"sh", "-c", #"""
|
||||
env
|
||||
test "$CHECK" = "\#(random)"
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
// Do a FetchContainer followed by a PushContainer, make sure
|
||||
// the ENV is preserved
|
||||
pullPush: {
|
||||
ref: "daggerio/ci-test:\(random)-pullpush"
|
||||
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: push.ref
|
||||
},
|
||||
op.#PushContainer & {
|
||||
"ref": ref
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
pullPushCheck: #up: [
|
||||
op.#FetchContainer & {
|
||||
ref: pullPush.ref
|
||||
},
|
||||
op.#Exec & {
|
||||
args: [
|
||||
"sh", "-c", #"""
|
||||
test "$CHECK" = "\#(random)"
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
29
tests/ops/subdir/simple/main.cue
Normal file
29
tests/ops/subdir/simple/main.cue
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
hello: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
{
|
||||
do: "fetch-container"
|
||||
ref: "alpine"
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["mkdir", "-p", "/tmp/foo"]
|
||||
},
|
||||
{
|
||||
do: "exec"
|
||||
args: ["sh", "-c", "echo -n world > /tmp/foo/hello"]
|
||||
},
|
||||
{
|
||||
do: "subdir"
|
||||
dir: "/tmp/foo"
|
||||
},
|
||||
{
|
||||
do: "export"
|
||||
source: "/hello"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user