-
Notifications
You must be signed in to change notification settings - Fork 854
Europa: output files #1317
Copy link
Copy link
Closed
Milestone
Description
PR #1289 added support for plan outputs, but the contents need to be an #FS.
If you have a string to save, you have to go through #WriteFile:
// plans/gen/dagger.cue
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"encoding/yaml"
)
engine.#Plan & {
actions: {
scratch: engine.#Scratch
apps: [string]: #App & {
output: _ // compose in CUE
compose: engine.#WriteFile & {
input: scratch.output
path: "/compose.yaml"
contents: yaml.Marshal(output)
}
}
}
for app, config in actions.apps {
outputs: directories: "\(app)": {
contents: config.compose.output
dest: "../../apps/\(app)" // output to: apps/<app>/compose.yaml
}
}
}But I think this will be common enough that also supporting string directly is justified, maybe under files:
// europa/dagger/engine/plan.cue
#DAG: {
...
// Send outputs to the client
outputs: {
directories: [name=string]: _#outputDirectory
files: [name=string]: _#outputFile
}
}
_#outputFile: {
$dagger: task: _name: "OutputFile"
// File contents to export
contents: string
// Export to this path ON THE CLIENT MACHINE
dest: string
}
// plans/gen/dagger.cue
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"encoding/yaml"
)
engine.#Plan & {
actions: {
apps: [string]: #App
}
for app, config in actions.apps {
outputs: files: "\(app)": {
contents: yaml.Marshal(config.output)
dest: "../../apps/\(app)/compose.yaml" // output to: apps/<app>/compose.yaml
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels