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/llb/push-container/main.cue
Andrea Luzzardi 93296fa358 tests: move llb tests into tests/llb
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-03-31 18:49:53 -07:00

57 lines
873 B
CUE

package main
import (
"dagger.io/llb"
"dagger.io/alpine"
)
TestPushContainer: {
// Generate a random number
random: {
string
#compute: [
llb.#Load & {from: alpine.#Image},
llb.#Exec & {
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
},
llb.#Export & {
source: "/rand"
},
]
}
// Push an image with a random tag
push: {
ref: "daggerio/ci-test:\(random)"
#compute: [
llb.#WriteFile & {
content: random
dest: "/rand"
},
llb.#PushContainer & {
"ref": ref
},
]
}
// Pull the image back
pull: #compute: [
llb.#FetchContainer & {
ref: push.ref
},
]
// Check the content
check: #compute: [
llb.#Load & {from: alpine.#Image},
llb.#Exec & {
args: [
"sh", "-c", #"""
test "$(cat /src/rand)" = "\#(random)"
"""#,
]
mount: "/src": from: pull
},
]
}