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:
committed by
Solomon Hykes
parent
67ecde8c30
commit
37db71104c
@@ -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 & {}
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user