os.#Container: mount secrets with a more consistent API

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes
2021-06-23 10:46:56 +00:00
committed by Solomon Hykes
parent 9d85bab9e7
commit aa6335246b
6 changed files with 69 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
package main
import (
"dagger.io/dagger"
"dagger.io/os"
)
// Test secret mount
SimpleSecret: {
// 'encrypted' and 'cleartext' must be set from identical values
encrypted: dagger.#Secret @dagger(input)
cleartext: string @dagger(input)
ctr: os.#Container & {
secret: "/secret-in": encrypted
command: "cat /secret-in > /secret-out"
}
// Decrypted secret
decrypted: (os.#File & {
from: ctr
path: "/secret-out"
}).contents @dagger(output)
// Assertion: decrypted value must match original cleartext
decrypted: cleartext
}