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/gcp/gcr/.dagger/env/default/plan/gcr.cue
Tom Chauveau fdb91a7332 Refactor random generation into a definition to make it reusable
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-07 23:39:41 +02:00

84 lines
1.2 KiB
CUE

package gcr
import (
"dagger.io/gcp"
"dagger.io/gcp/gcr"
"dagger.io/dagger/op"
)
TestConfig: gcpConfig: gcp.#Config
TestGCR: {
random: #Random & {}
repository: "gcr.io/dagger-ci/test"
tag: "test-gcr-\(random.out)"
creds: gcr.#Credentials & {
config: TestConfig.gcpConfig
}
push: {
ref: "\(repository):\(tag)"
#up: [
op.#DockerBuild & {
dockerfile: """
FROM alpine
RUN echo \(random.out) > /test
"""
},
op.#DockerLogin & {
target: repository
username: creds.username
secret: creds.secret
},
op.#PushContainer & {
"ref": ref
},
]
}
pull: #up: [
op.#DockerLogin & {
target: push.ref
username: creds.username
secret: creds.secret
},
op.#FetchContainer & {
ref: push.ref
},
]
verify: #up: [
op.#Load & {
from: pull
},
op.#Exec & {
always: true
args: [
"sh", "-c", "test $(cat test) = \(random.out)",
]
},
]
verifyBuild: #up: [
op.#DockerLogin & {
target: push.ref
username: creds.username
secret: creds.secret
},
op.#DockerBuild & {
dockerfile: #"""
FROM \#(push.ref)
RUN test $(cat test) = \#(random.out)
"""#
},
]
}