Move push and pull tests plans to docker subpackages
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
25
stdlib/docker/tests/pull/pull.cue
Normal file
25
stdlib/docker/tests/pull/pull.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
ref: string @dagger(input)
|
||||
|
||||
TestPull: {
|
||||
pull: #Pull & {from: ref}
|
||||
|
||||
check: #up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
always: true
|
||||
args: [
|
||||
"sh", "-c", """
|
||||
grep -q "test" /src/test.txt
|
||||
""",
|
||||
]
|
||||
mount: "/src": from: pull
|
||||
},
|
||||
]
|
||||
}
|
33
stdlib/docker/tests/push-invalid-creds/push.cue
Normal file
33
stdlib/docker/tests/push-invalid-creds/push.cue
Normal file
@@ -0,0 +1,33 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/random"
|
||||
)
|
||||
|
||||
TestRegistry: {
|
||||
username: string @dagger(input)
|
||||
secret: string @dagger(input)
|
||||
}
|
||||
|
||||
TestPush: {
|
||||
tag: random.#String & {seed: "docker push and pull should fail"}
|
||||
|
||||
name: "daggerio/ci-test:\(tag.out)"
|
||||
|
||||
image: #ImageFromDockerfile & {
|
||||
dockerfile: """
|
||||
FROM alpine
|
||||
RUN echo "test" > /test.txt
|
||||
"""
|
||||
context: ""
|
||||
}
|
||||
|
||||
push: #Push & {
|
||||
"name": name
|
||||
source: image
|
||||
auth: {
|
||||
username: TestRegistry.username
|
||||
secret: TestRegistry.secret
|
||||
}
|
||||
}
|
||||
}
|
62
stdlib/docker/tests/push/push.cue
Normal file
62
stdlib/docker/tests/push/push.cue
Normal file
@@ -0,0 +1,62 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/alpine"
|
||||
"alpha.dagger.io/random"
|
||||
)
|
||||
|
||||
TestRegistry: {
|
||||
username: string @dagger(input)
|
||||
secret: dagger.#Secret @dagger(input)
|
||||
}
|
||||
|
||||
#TestGetSecret: {
|
||||
secret: dagger.#Artifact
|
||||
|
||||
out: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
|
||||
op.#Exec & {
|
||||
always: true
|
||||
args: ["sh", "-c", "cp /input/secret /secret"]
|
||||
mount: "/input/secret": "secret": secret
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/secret"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
TestPush: {
|
||||
tag: random.#String & {seed: "docker push"}
|
||||
|
||||
name: "daggerio/ci-test:\(tag.out)"
|
||||
|
||||
secret: #TestGetSecret & {
|
||||
secret: TestRegistry.secret
|
||||
}
|
||||
|
||||
image: #ImageFromDockerfile & {
|
||||
dockerfile: """
|
||||
FROM alpine
|
||||
RUN echo "test" > /test.txt
|
||||
"""
|
||||
context: ""
|
||||
}
|
||||
|
||||
push: #Push & {
|
||||
"name": name
|
||||
source: image
|
||||
auth: {
|
||||
username: TestRegistry.username
|
||||
"secret": secret.out
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user