docs: Add guide to showcase handling outputs

Add a guide which highlights how to handle action's outputs by writing
them to the client filesystem and using CUE's integrations to marshal
them as JSON.

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
This commit is contained in:
Marcos Lilljedahl
2022-04-11 18:55:36 -03:00
committed by Solomon Hykes
parent 67ecde8c30
commit 37db71104c
5 changed files with 64 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
#SomeAction: {
// Nop to make dagger run the action
core.#Nop & {}
url: "test.com"
deployUrl: "test.com/deploy"
logsUrl: "test.com/logs"
}
dagger.#Plan & {
client: filesystem: "output.json": write: contents: json.Marshal({
url: actions.test.url
deployUrl: actions.test.deployUrl
logsUrl: actions.test.logsUrl
})
actions: {
test: #SomeAction & {}
}
}

View File

@@ -0,0 +1,15 @@
dagger.#Plan & {
client: filesystem: "output.txt": write: contents: actions.test.export.files["/hello.txt"]
actions: {
_image: alpine.#Build & {
packages: bash: {}
}
test: bash.#Run & {
input: _image.output
script: contents: "echo Hello World! > /hello.txt"
export: files: "/hello.txt": string
}
}
}