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/stdlib/aws/ecr/tests/ecr.cue
Tom Chauveau 2fbb9e7744 Update import to alpha version
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-25 17:26:51 +02:00

88 lines
1.3 KiB
CUE

package ecr
import (
"alpha.dagger.io/aws"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/random"
)
TestConfig: awsConfig: aws.#Config & {
region: "us-east-2"
}
TestECR: {
suffix: random.#String & {
seed: ""
}
repository: "125635003186.dkr.ecr.\(TestConfig.awsConfig.region).amazonaws.com/dagger-ci"
tag: "test-ecr-\(suffix.out)"
creds: #Credentials & {
config: TestConfig.awsConfig
}
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: [
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) = \(suffix.out)",
]
},
]
verifyBuild: #up: [
op.#DockerLogin & {
target: push.ref
username: creds.username
secret: creds.secret
},
op.#DockerBuild & {
dockerfile: #"""
FROM \#(push.ref)
RUN test $(cat test) = \#(suffix.out)
"""#
},
]
}