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.
Files
dagger/pkg/dagger.io/dagger/utils.cue
2022-01-28 12:26:22 -07:00

61 lines
1.1 KiB
CUE

package dagger
import (
"encoding/yaml"
"encoding/json"
"dagger.io/dagger/engine"
)
// Access the source directory for the current CUE package
// This may safely be called from any package
#Source: engine.#Source
// A (best effort) persistent cache dir
#CacheDir: engine.#CacheDir
// A temporary directory for command execution
#TempDir: engine.#TempDir
// Select a subdirectory from a filesystem tree
#Subdir: {
// Input tree
input: engine.#FS
// Path of the subdirectory
// Example: "/build"
path: string
// Copy action
_copy: engine.#Copy & {
"input": engine.#Scratch
contents: input
source: path
dest: "/"
}
// Subdirectory tree
output: engine.#FS & _copy.output
}
// DecodeSecret is a convenience wrapper around #TransformSecret. The plain text contents of input is expected to match the format
#DecodeSecret: {
{
format: "json"
engine.#TransformSecret & {
#function: {
input: _
output: json.Unmarshal(input)
}
}
} | {
format: "yaml"
engine.#TransformSecret & {
#function: {
input: _
output: yaml.Unmarshal(input)
}
}
}
}