4c40a87634
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
86 lines
1.2 KiB
CUE
86 lines
1.2 KiB
CUE
package main
|
|
|
|
import (
|
|
"dagger.io/aws"
|
|
"dagger.io/aws/ecr"
|
|
"dagger.io/dagger/op"
|
|
)
|
|
|
|
TestConfig: awsConfig: aws.#Config & {
|
|
region: "us-east-2"
|
|
}
|
|
|
|
TestECR: {
|
|
random: #Random & {}
|
|
|
|
repository: "125635003186.dkr.ecr.\(TestConfig.awsConfig.region).amazonaws.com/dagger-ci"
|
|
tag: "test-ecr-\(random.out)"
|
|
|
|
creds: ecr.#Credentials & {
|
|
config: TestConfig.awsConfig
|
|
}
|
|
|
|
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)
|
|
"""#
|
|
},
|
|
]
|
|
}
|