Documentation
¶
Index ¶
- Constants
- Variables
- func BrokerTaskIDFromExecutionMetadata(meta map[string]any) string
- func LiveLogStreamURL(brokerTaskID string) (string, error)
- func MintLiveLogStreamToken(brokerTaskID string, now time.Time) (string, time.Time, error)
- func ValidateLiveLogStreamToken(tokenString, brokerTaskID, secret string) error
- type ActiveTask
- type BrokerClient
- func (b *BrokerClient) CancelTask(brokerTaskID string) error
- func (b *BrokerClient) CreateTask(p CreateTaskParams) (string, error)
- func (b *BrokerClient) FetchTaskStatus(taskID string) (*Task, error)
- func (b *BrokerClient) ListActiveTasks() ([]ActiveTask, error)
- func (b *BrokerClient) ProcessWebhook(body []byte) (*Task, error)
- type BrokerEnvironmentVariable
- type CreateTaskParams
- type EnvironmentVariable
- type LiveLogAccessContext
- type LiveLogSession
- type LiveLogStreamTokenClaims
- type Runner
- func (c *Runner) Cancel(ctx core.ExecutionContext) error
- func (c *Runner) Cleanup(ctx core.SetupContext) error
- func (c *Runner) Color() string
- func (c *Runner) Configuration() []configuration.Field
- func (c *Runner) Description() string
- func (c *Runner) Documentation() string
- func (c *Runner) ExampleOutput() map[string]any
- func (c *Runner) Execute(ctx core.ExecutionContext) error
- func (c *Runner) HandleHook(ctx core.ActionHookContext) error
- func (c *Runner) HandleWebhook(ctx core.WebhookRequestContext) (int, *core.WebhookResponseBody, error)
- func (c *Runner) Hooks() []core.Hook
- func (c *Runner) Icon() string
- func (c *Runner) Label() string
- func (c *Runner) Name() string
- func (c *Runner) OutputChannels(configuration any) []core.OutputChannel
- func (c *Runner) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
- func (c *Runner) Setup(ctx core.SetupContext) error
- type Spec
- type Task
- type TaskLogSink
Constants ¶
const ( EnvironmentValueSourceLiteral = "literal" EnvironmentValueSourceSecret = "secret" )
const ( LiveLogStreamTokenPurpose = "runner_live_logs" LiveLogStreamTokenAudience = "task_broker" )
const ( ExecutionMetadataBrokerTaskID = "runner_broker_task_id" ExecutionMetadataTaskLog = "runner_task_log" )
const ( PassedOutputChannel = "passed" FailedOutputChannel = "failed" RunnerFinishedEventType = "runner.finished" )
const ( ExecutionModeHost = "host" ExecutionModeDocker = "docker" // DockerImagePresetCustom selects the free-text docker_image field instead of a quick-pick ref. DockerImagePresetCustom = "custom" // DefaultExecutionTimeoutSeconds is the wall-clock limit when a node omits execution_timeout_seconds. DefaultExecutionTimeoutSeconds = 3600 // 1 hour )
Execution modes accepted by the task broker / fleet manager (lowercase JSON).
Variables ¶
var ( ErrLiveLogCanvasNotFound = errors.New("canvas not found") ErrLiveLogExecutionNotFound = errors.New("execution not found") ErrLiveLogNodeNotFound = errors.New("node not found") ErrLiveLogNotRunner = errors.New("not a runner component") ErrLiveLogBrokerTaskMissing = errors.New("broker task id missing") )
Functions ¶
func BrokerTaskIDFromExecutionMetadata ¶ added in v0.23.0
func LiveLogStreamURL ¶ added in v0.23.0
func MintLiveLogStreamToken ¶ added in v0.23.0
func ValidateLiveLogStreamToken ¶ added in v0.23.0
ValidateLiveLogStreamToken validates a browser stream token and ensures it matches the requested task.
Types ¶
type ActiveTask ¶ added in v0.22.0
type ActiveTask struct {
ID string `json:"id"`
Status string `json:"status"`
FleetID string `json:"fleet_id"`
CreatedAt time.Time `json:"created_at"`
ClaimedAt *time.Time `json:"claimed_at,omitempty"`
LeaseUntil *time.Time `json:"lease_until,omitempty"`
RunnerID string `json:"runner_id,omitempty"`
ExecutionMode string `json:"execution_mode,omitempty"`
DockerImage string `json:"docker_image,omitempty"`
CancelRequested bool `json:"cancel_requested,omitempty"`
ExecutionTimeoutSeconds *int `json:"execution_timeout_seconds,omitempty"`
}
ActiveTask is a non-terminal task from GET /v1/tasks on the task broker.
type BrokerClient ¶
type BrokerClient struct {
// contains filtered or unexported fields
}
func NewBrokerClient ¶
func NewBrokerClient(httpClient core.HTTPContext) (*BrokerClient, error)
func (*BrokerClient) CancelTask ¶ added in v0.22.0
func (b *BrokerClient) CancelTask(brokerTaskID string) error
func (*BrokerClient) CreateTask ¶
func (b *BrokerClient) CreateTask(p CreateTaskParams) (string, error)
func (*BrokerClient) FetchTaskStatus ¶
func (b *BrokerClient) FetchTaskStatus(taskID string) (*Task, error)
func (*BrokerClient) ListActiveTasks ¶ added in v0.22.0
func (b *BrokerClient) ListActiveTasks() ([]ActiveTask, error)
func (*BrokerClient) ProcessWebhook ¶
func (b *BrokerClient) ProcessWebhook(body []byte) (*Task, error)
type BrokerEnvironmentVariable ¶
BrokerEnvironmentVariable is forwarded to the task broker as JSON.
type CreateTaskParams ¶
type CreateTaskParams struct {
Commands []string
WebhookURL string
Environment []BrokerEnvironmentVariable
ExecutionMode string
DockerImage string
TimeoutSeconds int // 0 = DefaultExecutionTimeoutSeconds
}
CreateTaskParams is forwarded to the task broker POST /v1/tasks.
type EnvironmentVariable ¶
type EnvironmentVariable struct {
Name string `json:"name" mapstructure:"name"`
ValueSource string `json:"valueSource" mapstructure:"valueSource"`
Value *string `json:"value,omitempty" mapstructure:"value"`
Secret configuration.SecretKeyRef `json:"secret,omitempty" mapstructure:"secret"`
}
EnvironmentVariable is one row in the Runner "Environment variables" list.
type LiveLogAccessContext ¶ added in v0.23.0
type LiveLogAccessContext struct {
BrokerTaskID string
}
LiveLogAccessContext is the resolved runner execution context for live log access.
func ResolveLiveLogAccess ¶ added in v0.23.0
type LiveLogSession ¶ added in v0.23.0
type LiveLogSession struct {
StreamURL string `json:"stream_url"`
Token string `json:"token"`
ExpiresAt time.Time `json:"expires_at"`
}
LiveLogSession is returned to the browser after SuperPlane authorizes log access.
func NewLiveLogSession ¶ added in v0.23.0
func NewLiveLogSession(brokerTaskID string, now time.Time) (*LiveLogSession, error)
type LiveLogStreamTokenClaims ¶ added in v0.23.0
type LiveLogStreamTokenClaims struct {
TaskID string `json:"task_id"`
Purpose string `json:"purpose"`
gojwt.RegisteredClaims
}
LiveLogStreamTokenClaims is the JWT payload SuperPlane mints for browser → task-broker streaming.
type Runner ¶
type Runner struct{}
func (*Runner) Configuration ¶
func (c *Runner) Configuration() []configuration.Field
func (*Runner) Description ¶
func (*Runner) Documentation ¶
func (*Runner) ExampleOutput ¶
func (*Runner) HandleHook ¶
func (c *Runner) HandleHook(ctx core.ActionHookContext) error
func (*Runner) HandleWebhook ¶
func (c *Runner) HandleWebhook(ctx core.WebhookRequestContext) (int, *core.WebhookResponseBody, error)
func (*Runner) OutputChannels ¶
func (c *Runner) OutputChannels(configuration any) []core.OutputChannel
func (*Runner) ProcessQueueItem ¶
type Spec ¶
type Spec struct {
Commands string `mapstructure:"commands"`
Environment []EnvironmentVariable `mapstructure:"environment"`
ExecutionMode string `mapstructure:"execution_mode"`
DockerImagePreset string `mapstructure:"docker_image_preset"`
DockerImage string `mapstructure:"docker_image"`
ExecutionTimeoutSeconds int `mapstructure:"execution_timeout_seconds"` // 0 = DefaultExecutionTimeoutSeconds
}
Spec is persisted Runner node configuration.
type Task ¶
type Task struct {
TaskID string `json:"task_id"`
Status string `json:"status"`
ExitCode *int `json:"exit_code,omitempty"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
TaskLog *TaskLogSink `json:"task_log,omitempty"`
CloudWatchLogGroup string `json:"cloudwatch_log_group,omitempty"`
CloudWatchLogStream string `json:"cloudwatch_log_stream,omitempty"`
}
Task is the broker task payload (GET /v1/tasks/:id and webhook body).
func (*Task) IsInTerminalState ¶
type TaskLogSink ¶
type TaskLogSink struct {
Type string `json:"type"`
CloudWatch *struct {
LogGroupName string `json:"log_group_name"`
LogStreamName string `json:"log_stream_name"`
Region string `json:"region,omitempty"`
} `json:"cloudwatch,omitempty"`
}
TaskLogSink matches the task-broker / fleet-manager JSON shape for CloudWatch-backed live logs.