test: add push-container
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
56
tests/push-container/main.cue
Normal file
56
tests/push-container/main.cue
Normal file
@@ -0,0 +1,56 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/alpine"
|
||||
)
|
||||
|
||||
TestPushContainer: {
|
||||
// Generate a random number
|
||||
random: {
|
||||
string
|
||||
#compute: [
|
||||
dagger.#Load & {from: alpine.#Image},
|
||||
dagger.#Exec & {
|
||||
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
|
||||
},
|
||||
dagger.#Export & {
|
||||
source: "/rand"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Push an image with a random tag
|
||||
push: {
|
||||
ref: "daggerio/ci-test:\(random)"
|
||||
#compute: [
|
||||
dagger.#WriteFile & {
|
||||
content: random
|
||||
dest: "/rand"
|
||||
},
|
||||
dagger.#PushContainer & {
|
||||
"ref": ref
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Pull the image back
|
||||
pull: #compute: [
|
||||
dagger.#FetchContainer & {
|
||||
ref: push.ref
|
||||
},
|
||||
]
|
||||
|
||||
// Check the content
|
||||
check: #compute: [
|
||||
dagger.#Load & {from: alpine.#Image},
|
||||
dagger.#Exec & {
|
||||
args: [
|
||||
"sh", "-c", #"""
|
||||
test "$(cat /src/rand)" = "\#(random)"
|
||||
"""#,
|
||||
]
|
||||
mount: "/src": from: pull
|
||||
},
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user