-
Notifications
You must be signed in to change notification settings - Fork 854
Action API #1598
Copy link
Copy link
Closed
Description
Overview
I propose formalizing the concept of an action, and exposing it to developers in a new Action API.
Using the Action API, developers can:
- Customize how the DAG is presented to the user at runtime (show actual actions instead of raw CUE tree or low-level tasks)
- Synchronize actions: Support explicit dependency #940, Terminate an action #1249 , etc.
- Make error messages more useful. The hierarchy of actions act as a "stack frame" with less noise than raw CUE errors
This proposal is one part of a 4-part bundle:
- Action API #1598 (this proposal)
- Client API #1597
- 0.2 CLI #1558
- Merge dagger.io/dagger/engine into dagger.io/dagger #1579
Proposed design
This is a work in progress. Fire at will.
#Action definition
package dagger
#Action: {
_dagger: action: {
// Unique ID assigned by engine. Use for synchronization
id: #ID
// Human-friendly human name (defaults to parent field name)
name?: string
// Long description (defaults to comments above parent field)
description?: string
// Print a message to the user before executing the action
before?: string
// Print a message to the user after executing the action
after?: string
}
...
}
// A unique object ID allocated at runtime
#ID: stringUsage example:
package main
import (
"dagger.io"
)
dagger.#Plan & {
actions: {
// Not an action
staging: {
// This is an action
deploy: {
_dagger: action {
description: "Deploy staging environment"
after: """
Staging deployed:
Frontend: \(www.url)
Backend: \(api.url)
"""
}
www: netlify.#Deploy & {
...
}
api: ecs.#Deploy & {
...
}
}
}Synchronization
TODO
Core actions
Core actions implement the #Action interface, so their output can be customized, synchronized, etc. This is not yet implemented.
Related issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels