Move random string generation to his own file to avoid replication in tests.
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
@@ -12,20 +12,6 @@ registry: {
|
||||
}
|
||||
|
||||
TestPushContainer: {
|
||||
// Generate a random number
|
||||
random: {
|
||||
string
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
|
||||
},
|
||||
op.#Export & {
|
||||
source: "/rand"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Push an image with a random tag
|
||||
push: {
|
||||
ref: "daggerio/ci-test:\(random)"
|
||||
@@ -66,20 +52,6 @@ TestPushContainer: {
|
||||
|
||||
// Ensures image metadata is preserved in a push
|
||||
TestPushContainerMetadata: {
|
||||
// Generate a random number
|
||||
random: {
|
||||
string
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "echo -n $RANDOM > /rand"]
|
||||
},
|
||||
op.#Export & {
|
||||
source: "/rand"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// `docker build` using an `ENV` and push the image
|
||||
push: {
|
||||
ref: "daggerio/ci-test:\(random)-dockerbuild"
|
||||
|
20
tests/ops/push-container/random.cue
Normal file
20
tests/ops/push-container/random.cue
Normal file
@@ -0,0 +1,20 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"dagger.io/alpine"
|
||||
"dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
// Generate a random number
|
||||
random: {
|
||||
string
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c", "cat /dev/urandom | tr -dc 'a-z' | fold -w 10 | head -n 1 | tr -d '\n' > /rand"]
|
||||
},
|
||||
op.#Export & {
|
||||
source: "/rand"
|
||||
},
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user