This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/tests/stdlib/docker/push-pull/push-pull.cue
Tom Chauveau ebe26a90ca Move random string generation to his own file to avoid replication in tests.
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-05-22 16:49:57 +02:00

61 lines
826 B
CUE

package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/op"
"dagger.io/alpine"
"dagger.io/docker"
)
source: dagger.#Artifact
registry: {
username: string
secret: dagger.#Secret
}
TestPushAndPull: {
ref: "daggerio/ci-test:\(random)"
// Create image
image: docker.#ImageFromDockerfile & {
dockerfile: """
FROM alpine
COPY test.txt /test.txt
"""
context: source
}
// Login
login: #up: [
op.#DockerLogin & {
registry
},
]
// Push image
push: docker.#Push & {
"ref": ref
source: image
}
// Push image
pull: docker.#Pull & {
from: push.ref
}
// Check the content
verify: #up: [
op.#Load & {from: alpine.#Image},
op.#Exec & {
always: true
args: [
"sh", "-c", """
grep -q "test" /src/test.txt
""",
]
mount: "/src": from: pull
},
]
}