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