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/js/yarn/tests/yarn.cue
guillaume de8cd3a52a Add secrets for secure mount of .env local files inside Dagger
Signed-off-by: guillaume <guillaume.derouville@gmail.com>
2021-10-14 13:34:58 +02:00

58 lines
1015 B
CUE

package yarn
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/alpine"
"alpha.dagger.io/os"
)
TestData: dagger.#Artifact
TestReact: {
pkg: #Package & {
source: TestData
}
test: os.#Container & {
image: alpine.#Image & {
package: bash: "=5.1.0-r0"
}
mount: "/build": from: pkg.build
command: """
test "$(cat /build/test)" = "output"
"""
}
}
TestData2: dagger.#Artifact
TestSecretsAndFile: {
pkg: #Package & {
source: TestData2
writeEnvFile: "/.env"
env: {
one: "one"
two: "two"
}
secrets: {
secretone: dagger.#Secret @dagger(input)
secretwo: dagger.#Secret @dagger(input)
}
}
test: os.#Container & {
image: alpine.#Image & {
package: bash: "=5.1.0-r0"
}
shell: path: "/bin/bash"
mount: "/build": from: pkg.build
command: """
content="$(cat /build/env)"
[[ "${content}" = *"SECRETONE="* ]] && \\
[[ "${content}" = *"SECRETWO="* ]] && \\
[[ "${content}" = *"ONE=one"* ]] && \\
[[ "${content}" = *"TWO=two"* ]]
"""
}
}