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/stdlib/kubernetes/random.cue

34 lines
476 B
CUE
Raw Normal View History

package kubernetes
import (
"strconv"
"dagger.io/alpine"
"dagger.io/dagger/op"
)
#Random: {
size: *12 | number
out: {
string
#up: [
op.#Load & {from: alpine.#Image},
op.#Exec & {
always: true
args: ["sh", "-c", #"""
tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand
"""#,
]
env: SIZE: strconv.FormatInt(size, 10)
},
op.#Export & {
source: "/rand"
},
]
}
}